WLST操作の実行

WebLogic Scripting Tool (WLST)を使用して、Kubernetesクラスタで実行されているドメインを管理できます。多数あるその方法の一部を次に示します。

ドメインの作成時にexposeAdminT3Channelを使用してT3チャネルを公開するように管理サーバーが構成されている場合は、「WLSTの使用」を参照してください。

追加のポートを公開せず、WebLogic Server Kubernetesオペレータによって作成された既存のKubernetesサービスを使用してWLST管理操作を実行する場合は、このドキュメントに従います。ここでは、Oracle SOA Suiteドメインと同じKubernetesクラスタでヘルパー・ポッドを作成して使用し、WLST操作を実行します。

ノート:

構成の誤りを回避するために、WLST操作に管理サーバー・ポッドを直接使用しないことをお薦めします。
  1. Kubernetesヘルパー・ポッドの作成
  2. WLST操作の実行
  3. サンプルのWLST操作

Kubernetesヘルパー・ポッドの作成

Kubernetesヘルパー・ポッドを作成する前に、Oracle SOA Suite Dockerイメージがノードで使用できることを確認するか、ポッドが作成されたホストでDockerイメージをプルできるようにイメージ・プル・シークレットを作成できます。

  1. ヘルパー・ポッドによってイメージsoasuite:14.1.2.0をプルするイメージ・プル・シークレットを作成します。

    イメージ・プル・シークレットを使用していない場合は、このステップをスキップします。

    kubectl create secret docker-registry <secret-name> --namespace soans \
      --docker-server=<docker-registry-name> \
      --docker-username=<docker-user> \
      --docker-password=<docker-user> \
      --docker-email=<email-id>
    

    例:

    kubectl create secret docker-registry image-secret --namespace soans \
       --docker-server=your-registry.com \
       --docker-username=xxxxxx \
       --docker-password=xxxxxxx  \
       --docker-email=my@company.com
    
  2. ヘルパー・ポッドを作成します。
    kubectl run helper \
      --image <image_name> \
      --namespace <domain_namespace> \
      --overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "<secret-name>"}] } }' \
      -- sleep infinity
    

    例:

    kubectl run helper \
      --image soasuite:14.1.2.0 \
      --namespace soans \
      --overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "image-secret"}] } }' \
      -- sleep infinity
    

    ノート:

    イメージ・プル・シークレットを使用していない場合は、--overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "<secret-name>"}] } }'を削除します。

WLST操作の実行

Kubernetesヘルパー・ポッドがデプロイされたら、ポッドにexecし、t3またはt3sを使用してサーバーに接続し、WLST操作を実行できます。デフォルトでは、t3sは管理サーバーまたは管理対象サーバーに対して有効になっていません。ドメインの作成時にsslEnabledでSSLを有効にした場合、t3sを使用してWLST操作を実行できます。

対話モード

  1. ヘルパー・ポッドでbashシェルを起動します:
    kubectl exec -it helper -n <domain_namespace> -- /bin/bash

    例:

    kubectl exec -it helper -n soans -- /bin/bash

    これにより、実行中のヘルパー・ポッドにbashシェルが開きます:

    [oracle@helper oracle]$
  2. WLSTを起動します:
    [oracle@helper oracle]$ cd $ORACLE_HOME/oracle_common/common/bin
    [oracle@helper bin]$ ./wlst.sh
    

    出力は次のようになります:

    [oracle@helper bin]$ ./wlst.sh
    Initializing WebLogic Scripting Tool (WLST) ...
    Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away.
    Welcome to WebLogic Server Administration Scripting Shell
    Type help() for help on available commands
    wls:/offline>
    
  3. t3を使用して接続します:
    1. t3を使用して管理サーバーまたは管理対象サーバーに接続するには、WebLogic Server Kubernetesオペレータによって作成されたKubernetesサービスを使用します:
      wls:/offline> connect('weblogic','<password>','t3://<domainUID>-<WebLogic Server Name>:<Server Port>')

      たとえば、domainUIDがsoainfra、管理サーバー名がAdminServer、管理サーバー・ポートが7001の場合、t3を使用して管理サーバーに接続できます:

      wls:/offline> connect('weblogic','<password>','t3://soainfra-adminserver:7001')

      出力は次のようになります:

      wls:/offline> connect('weblogic','<password>','t3://soainfra-adminserver:7001')
      Connecting to t3://soainfra-adminserver:7001 with userid weblogic ...
      Successfully connected to Admin Server "AdminServer" that belongs to domain "soainfra".
      
      Warning: An insecure protocol was used to connect to the server.
      To ensure on-the-wire security, the SSL port or Admin port should be used instead.
      
      wls:/soainfra/serverConfig/>
      
    2. t3を使用してWebLogic Serverクラスタ(SOAまたはOracle Service Bus)を接続するには、WebLogic Server Kubernetesオペレータによって作成されたKubernetesサービスを使用します:
      wls:/offline> connect('weblogic','<password>','t3://<domainUID>-cluster-<Cluster name>:<Managed Server Port>')

      たとえば、domainUIDがsoainfra、SOAクラスタ名がsoa-cluster、SOA管理対象サーバー・ポートが7003の場合、t3を使用してSOAクラスタに接続できます:

      wls:/offline> connect('weblogic','<password>','t3://soainfra-cluster-soa-cluster:7003')

      出力は次のようになります:

      wls:/offline> connect('weblogic','<password>','t3://soainfra-cluster-soa-cluster:7003')
      Connecting to t3://soainfra-cluster-soa-cluster:7003 with userid weblogic ...
      Successfully connected to Managed Server "soa_server1" that belongs to domain "soainfra".
      
      Warning: An insecure protocol was used to connect to the server.
      To ensure on-the-wire security, the SSL port or Admin port should be used instead.
      
      wls:/soainfra/serverConfig/>
      
  4. ドメインの作成時にsslEnabledを使用してSSLを有効にした場合、t3sを使用してWLST操作を実行できます:
    1. 必要な環境値(DemoTrustで提供されているサンプル)を設定します:
      [oracle@helper oracle] $export WLST_PROPERTIES='-Dweblogic.security.TrustKeyStore=DemoTrust -Dweblogic.security.SSL.ignoreHostnameVerification=true'
            [oracle@helper oracle]
    2. t3sを使用して接続する前に、WLSTに接続し、必要な環境変数を設定します:
      [oracle@helper oracle]$ cd
       $ORACLE_HOME/oracle_common/common/bin
      [oracle@helper bin]$ ./wlst.sh
    3. セキュア・ドメインの管理サーバーのt3sにアクセスします。

      たとえば、domainUIDがsoainfra、SOAクラスタ名がsoa-cluster、SOA管理対象サーバーSSLポートが7004の場合、次のようにSOAクラスタに接続します:

      wls:/offline> connect('weblogic','<password>','t3s://soainfra-adminserver:7004')
    4. 非セキュア・ドメインのSOAクラスタのt3sにアクセスします。

      たとえば、domainUIDがsoainfra、SOAクラスタ名がsoa-cluster、SOAサーバーの管理ポートが9004の場合、次のようにSOAクラスタに接続します:

      wls:/offline> connect('weblogic','<password>','t3s://soainfra-adminserver:9004')

スクリプト・モード

スクリプト・モードでは、ファイル拡張子が.pyのテキスト・ファイル(たとえば、mywlst.py)にWLSTコマンドが含まれています。スクリプト・ファイルを使用してWLSTを起動する前に、.pyファイルをヘルパー・ポッドにコピーする必要があります。

.pyファイルをヘルパー・ポッドにコピーして、スクリプト・モードでWLST操作を使用するには:

  1. すべてのWLSTコマンドを含む.pyファイルを作成します。
  2. .pyファイルをヘルパー・ポッドにコピーします:
    kubectl cp <filename>.py <domain namespace>/helper:<directory>

    例:

    kubectl cp mywlst.py soans/helper:/u01/oracle
  3. ヘルパー・ポッドにexecして、.pyファイルでwlst.shを実行します:
    kubectl exec -it helper -n <domain_namespace> -- /bin/bash
    [oracle@helper oracle]$ cd $ORACLE_HOME/oracle_common/common/bin
    [oracle@helper oracle]$ ./wlst.sh <directory>/<filename>.py
    

ノート:

t3またはt3sを使用して接続する方法の詳細は、対話モードを参照してください。

サンプルのWLST操作

WLST操作の完全なリストは、WebLogic Server WLSTオンラインおよびオフライン・コマンド・リファレンスを参照してください。

サーバーの表示

kubectl exec -it helper -n soans -- /bin/bash
[oracle@helper oracle]$ cd $ORACLE_HOME/oracle_common/common/bin
[oracle@helper bin]$ ./wlst.sh

Initializing WebLogic Scripting Tool (WLST) ...

Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away.

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> connect('weblogic','Welcome1','t3://soainfra-adminserver:7001')
Connecting to t3://soainfra-adminserver:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "soainfra".

Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

wls:/soainfra/serverConfig/>  cd('/Servers')
wls:/soainfra/serverConfig/Servers> ls()
dr--   AdminServer
dr--   osb_server1
dr--   osb_server2
dr--   osb_server3
dr--   osb_server4
dr--   osb_server5
dr--   soa_server1
dr--   soa_server2
dr--   soa_server3
dr--   soa_server4
dr--   soa_server5

wls:/soainfra/serverConfig/Servers>