ClusterManager MBean を使用して Liberty サーバーのマージされたプラグイン構成を生成する
ClusterManager MBean generateClusterPluginConfig 操作を呼び出して、複数のホスト上にある複数のアプリケーション・サーバーに要求をリダイレクトするよう Web サーバー・プラグインに指示する、単一のマージされた plugin-cfg.xml ファイルを作成することができます。
このタスクについて
この操作により、まず、始動済みの各クラスター・メンバー上にサーバー固有の plugin-cfg.xml ファイルが生成されます。次に、サーバー固有の plugin-cfg.xml ファイルが、クラスター・マネージャー上の 1 つの plugin-cfg.xml ファイルにマージされます。
この操作は、クラスターに少なくとも 2 つの始動済みクラスター・メンバーがある場合にのみ機能します。クラスター・マネージャー上のマージされた plugin-cfg.xml ファイルへのパスが、クライアントに返されます。このため、このファイルは fileTransfer MBean を使用してダウンロード可能です。
マージされた plugin-cfg.xml ファイルの名前は <clusterName>-plugin-cfg.xml となります。デフォルトでは、このファイルはクラスター・マネージャー上の以下のディレクトリーに保存されます。
${server.output.dir}/pluginConfig
このディレクトリーは、server.xml ファイル内で clusterPluginConfig エレメントを指定することで変更できます。
<clusterPluginConfig>
<outputDir>new output directory</outputDir>
</clusterPluginConfig>
注: 新しい出力ディレクトリーは、fileTransfer MBean によって書き込みおよびアクセス可能であることを確認してください。詳細については、fileTransfer MBean の資料を参照してください。
例:
// call the generateClusterPluginConfig operation on the ClusterManager MBean to generate
// a merged plugin-cfg.xml file for all started cluster members.
String clusterName = "myCluster";
ObjectName rmObjectName = new ObjectName("WebSphere:feature=collectiveController,type=ClusterManager,name=ClusterManager");
// rcObj contains the absolute path to the merged plugin-cfg.xml file.
Object rcObj = connection.invoke(rmObjectName, "generateClusterPluginConfig",
new Object[] { clusterName },
new String[] { "java.lang.String" });
// invoke the downloadFile operation on fileTransfer MBean to download the merged plugin-cfg.xml to the client.
String sourceFilePath = (String) rcObj;
String targetFilePath = "<my target directory>";
ObjectName objectName = new ObjectName("WebSphere:feature=restConnector,type=FileTransfer,name=FileTransfer");
connection.invoke(objectName, "downloadFile",
new String[] { sourceFilePath, targetFilePath },
new String[] { "java.lang.String", "java.lang.String" });
クラスター管理について詳しくは、ClusterManager MBean の資料を参照してください。