使用 wsadmin Scripting 的 AdminTask 物件指令
請利用 AdminTask 物件,以 wsadmin 工具來執行管理指令。
當您啟動 wsadmin 工具時,會動態載入管理指令。可用的管理指令及其用途,會隨著所用的產品版本而不同。
您可以利用 wsadmin 工具的 -conntype NONE 選項,在沒有執行伺服器的情況下,啟動 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 指令提供說明指令的摘要及呼叫管理指令的方法。您可以在指令語法中使用萬用字元 (*) 或 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')
- 使用 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')