使用 wsadmin Scripting 的 AdminTask 物件指令
請利用 AdminTask 物件,以 wsadmin 工具來執行管理指令。
當您啟動 wsadmin 工具時,會動態載入管理指令。 可用的管理指令及其用途,會隨著所用的產品版本而不同。
您可以使用 -conntype
NONE 選項搭配 wsadmin 工具來啟動 Scripting 用戶端,而不需要執行伺服器。 AdminTask 管理指令可在連接模式和本端模式中使用。 如果伺服器目前在執行中,則不建議在本端模式下執行 AdminTask 指令,因為在本端模式下所做的任何配置變更並不會反
映在執行中的伺服器配置,反之亦然。 如果您儲存衝突的配置,配置可能會毀損。
在部署管理程式環境中,只有在 Scripting 用戶端連接至部署管理程式時,才能夠使用配置更新。 當連接至節點代理程式或受管理的應用程式伺服器時,您無法更新配置,因為這些伺服器程序的 配置是位於部署管理程式中之主要配置的複本。 當在部署管理程式和節點代理程式之間進行配置同步化時,就會在節點機器中建立複本。 請將 Scripting 用戶端連接至部署管理程式,來進行伺服器程序的配置變更。 如果要變更配置,請勿在節點機器的本端模式下執行 Scripting 用戶端,因為這是不受支援的。
set nodeparm "node1"
$AdminTask setJVMMaxHeapSize [subst {-serverName server1 -nodeName $nodeparm -maximumHeapSize 100}]createTCPEndPoint
createTCPEndPoint 指令會建立新的端點,您可以將這個端點關聯於某個 TCP 入埠通道。
目標物件
包含 TCPInboundChannel 之 TransportChannelService 的母項實例。 (ObjectName,必要)必要參數
- -name
- 指定新端點的名稱。 (字串,必要)
- -host
- 指定新端點的主機。 (字串,必要)
- -port
- 指定新端點的埠。 (字串,必要)
選用參數
無。範例輸出
指令傳回所建立端點的物件名稱。範例
批次模式下的用法範例:
- 使用 Jacl:
$AdminTask createTCPEndPoint (cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TransportChannelService_1) {-name Sample_End_Pt_Name -host mybuild.location.ibm.com -port 8978} - 使用 Jython 字串:
AdminTask.createTCPEndPoint('cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TransportChannelService_1', '[-name Sample_End_Pt_Name -host mybuild.location.ibm.com -port 8978]') - 使用 Jython 清單:
AdminTask.createTCPEndPoint('cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TransportChannelService_1', ['-name', 'Sample_End_Pt_Name', '-host', 'mybuild.location.ibm.com', '-port', '8978'])
互動模式下的用法範例:
- 使用 Jacl:
$AdminTask createTCPEndPoint {-interactive} - 使用 Jython:
AdminTask.createTCPEndPoint('-interactive')
getTCPEndPoint
getTCPEndPoint 指令會取得與 TCP 入埠通道或包含 TCP 入埠通道的鏈相關聯的指名端點。
目標物件
與 NamedEndPoint 相關聯的 TCPInboundChannel(或包含端的鏈)實例。 (ObjectName,必要)必要參數
無。選用參數
無。範例輸出
指令傳回關聯於 TCP 入埠通道實例或通道鏈之現有指名端點的物件名稱。範例
批次模式下的用法範例:
- 使用 Jacl:
$AdminTask getTCPEndPoint TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01 /servers/dmgr|server.xml#TCPInboundChannel_1)$AdminTask getTCPEndPoint DCS(cells/mybuildCell01/nodes/mybuildCellManager01 /servers/dmgr|server.xml#Chain_3) - 使用 Jython 字串:
print AdminTask.getTCPEndPoint('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01 /servers/dmgr|server.xml#TCPInboundChannel_1)')print AdminTask.getTCPEndPoint('DCS(cells/mybuildCell01/nodes/mybuildCellManager01 /servers/dmgr|server.xml#Chain_3)') - 使用 Jython 清單:
print AdminTask.getTCPEndPoint('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01 /servers/dmgr|server.xml#TCPInboundChannel_1)')print AdminTask.getTCPEndPoint('DCS(cells/mybuildCell01/nodes/mybuildCellManager01 /servers/dmgr|server.xml#Chain_3)')
互動模式下的用法範例:
- 使用 Jacl:
$AdminTask getTCPEndPoint {-interactive} - 使用 Jython:
print AdminTask.getTCPEndPoint('-interactive')
help
help 指令提供說明指令的摘要及呼叫管理指令的方法。 您可以利用指令語法中的萬用字元 (*) 或 Java 正規表示式 (.*) 來自訂搜尋查詢。
目標物件
無。選用參數
- -commands
- 如果您使用
-commands參數, help 指令會提供可用的管理指令清單。 (字串,選用) - -commandGroups
- 如果您使用
-commandGroups參數,則 help 指令會提供管理指令群組的清單。 (字串,選用) - -commandName
- help 指令會提供給定管理指令的說明資訊。 (字串,選用)
- -stepName
- help 指令會提供管理指令給定步驟的說明資訊。 (字串,選用)
範例輸出
這個指令傳回 AdminTask 物件的一般指令資訊。範例
批次模式下的用法範例:
- 使用 Jacl:
$AdminTask help - 使用 Jython:
print AdminTask.help()
- 使用 Jacl:
$AdminTask help -commands - 使用 Jython:
print AdminTask.help('-commands')
- 使用 Jacl:
$AdminTask help createJ2CConnectionFactory - 使用 Jython:
print AdminTask.help('createJ2CConnectionFactory')
create 字串的指令:- 使用 Jacl:
$AdminTask help -commands *create* - 使用 Jython:
print AdminTask.help('-commands *create*')
- 使用 Jacl:
$AdminTask help -commands <pattern> - 使用 Jython:
print AdminTask.help('-commands <pattern>')
listTCPEndPoints
listTCPEndPoints 指令會列出能夠關聯於 TCP 入埠通道的所有指名端點。
目標物件
列出指名端點候選項的 TCP 入埠通道實例。 (ObjectName,必要)必要參數
無。選用參數
- -excludeDistinguished
- 指定是否只顯示非識別的指名端點。 這個參數不需要值。 (Boolean,選用)
- -unusedOnly
- 指定是否顯示沒有其他 TCP 入埠通道實例在使用的指名端點。 這個參數不需要值。 (Boolean,選用)
範例輸出
這個指令會傳回合格指名端點的物件名稱清單。範例
批次模式下的用法範例:
- 使用 Jacl:
$AdminTask listTCPEndPoints TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)$AdminTask listTCPEndPoints TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1) {-excludeDistinguished}$AdminTask listTCPEndPoints TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1) {-excludeDistinguished -unusedOnly} - 使用 Jython 字串:
print AdminTask.listTCPEndPoints('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)', '[-excludeDistinguished]')print AdminTask.listTCPEndPoints('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)', '[-excludeDistinguished]')print AdminTask.listTCPEndPoints('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)', '[-excludeDistinguished -unusedOnly]') - 使用 Jython 清單:
print AdminTask.listTCPEndPoints('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)', ['-excludeDistinguished'])print AdminTask.listTCPEndPoints('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)', ['-excludeDistinguished'])print AdminTask.listTCPEndPoints('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)', ['-excludeDistinguished', '-unusedOnly'])
互動模式下的用法範例:
- 使用 Jacl:
$AdminTask listTCPEndPoints {-interactive} - 使用 Jython:
print AdminTask.listTCPEndPoints('-interactive')
listTCPThreadPools
listTCPThreadPools 指令會列出能夠關聯於 TCP 入埠通道或 TCP 出埠通道的所有執行緒儲存區。
目標物件
列出 ThreadPool 候選項的 TCPInboundChannel 或 TCPOutboundChannel 實例。 (ObjectName,必要)必要參數
無。選用參數
無。範例輸出
這個指令會傳回合格執行緒儲存區物件名稱的清單。範例
批次模式下的用法範例:
- 使用 Jacl:
$AdminTask listTCPThreadPools TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1) - 使用 Jython 字串:
print AdminTask.listTCPThreadPools('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)') - 使用 Jython 清單:
print AdminTask.listTCPThreadPools('TCP_1(cells/mybuildCell01/nodes/mybuildCellManager01/servers/dmgr|server.xml#TCPInboundChannel_1)')
互動模式下的用法範例:
- 使用 Jacl:
$AdminTask listTCPThreadPools {-interactive} - 使用 Jython:
print AdminTask.listTCPThreadPools('-interactive')
updateAppOnCluster
updateAppOnCluster 指令可用來同步化節點,以及重新啟動部署在叢集中的應用程式更新叢集成員。 應用程式更新之後,就可以利用這個指令來同步化節點,不需要同時停 止所有節點中的叢集成員。 這個指令會每次同步化一個節點。 每個節點的同步化方式都是先停止應用程式的目標叢集成員,再執行節點同步化作業,然後重新啟動叢集成員。
這個指令所花的時間可能比預設連接器逾時期間長,這會根據目標叢集所包含的節點數目而定。 當使用 SOAP 連接器時,請務必在 profile_root/properties 目錄的 soap.client.props 檔中設定適當的逾時值; 當使用 JSR160RMI 連接器或 RMI 連接器時,在 sas.client.props 檔中設定適當的逾時值; 當使用 IPC 連接器時,請在 ipc.client.props 檔中設定適當的逾時值。
本端模式不支援這個指令。
目標物件
無。必要參數
- -ApplicationNames
- 指定所更新之應用程式的名稱。 (字串,必要)
選用參數
- -timeout
- 指定每次節點同步化的逾時值(秒)。 預設值是
300秒。 (整數,選用)
範例輸出
指令不傳回輸出。範例
批次模式下的用法範例:
- 使用 Jacl:
$AdminTask updateAppOnCluster {-ApplicationNames app1}$AdminTask updateAppOnCluster {-ApplicationNames app1 -timeout 600} - 使用 Jython 字串:
AdminTask.updateAppOnCluster('[-ApplicationNames app1]')AdminTask.updateAppOnCluster('[-ApplicationNames app1 -timeout 600]') - 使用 Jython 清單:
AdminTask.updateAppOnCluster(['-ApplicationNames', 'app1'])AdminTask.updateAppOnCluster(['-ApplicationNames', 'app1', '-timeout', '600'])
互動模式下的用法範例:
- 使用 Jacl:
$AdminTask updateAppOnCluster -interactive - 使用 Jython:
AdminTask.updateAppOnCluster('-interactive')