Script interface to install an arbitrary files to all nodes in Websphere?

筅森魡賤 提交于 2019-12-12 16:26:11

问题


I'm rather new to wsadmin and the administration client available for Websphere. I was wondering if anyone had an example of deploying arbitrary files to every Node in a Cell? Ideally I am looking for a solution that would work with both Websphere ND v7 and v6.1, and would not resort to native file transfer methods (e.g. windows shares / sftp), although if there is configuration that could be discovered through the Deployment Manager as to what native method to take to deploy the file that could be an option.

For some background, I'm trying to script the installation of an application for our clients. As part of that I will need to create a JDBC provider and a shared library along with my Application. IBM's documentation is fairly clear on how to create shared library with a particular classpath, and a JDBC Provider, and Websphere variables. But I am running into the problem of how I should go about ensuring that the resources defined on the classpaths of the configured provider and shared library are available on each Node at runtime?


回答1:


Arbitrary files can be managed centrally using wsadmin's AdminConfig object. This approach places the files in WAS's configuration repository which is monitored by the node synchronization service, and therefore automatically synchronizes file changes from the master repository with each node repository. There are existing wsadmin commands that enable the files to be added, updated, and deleted centrally and remotely.

Here is some example wsadmin jython code which will upload a local file (/temp/jdbc-driver.jar) to the configuration repository (<WAS_PROFILE_ROOT>/config/test-app/jdbc-driver.jar). The node synchronization may be explicitly invoked as demonstrated in the script, or the synchronization will occur automatically if automatic synchronization is enabled.

file = "/temp/jdbc-driver.jar"
dest = "test-app/jdbc-driver.jar"
AdminConfig.createDocument(dest, file)
AdminNodeManagement.syncActiveNodes()

The following wsadmin jython code demonstrates how to update the file.

file = "/temp/jdbc-driver.jar"
dest = "test-app/jdbc-driver.jar"
digest = AdminConfig.extract(dest, file)
# update the file locally in /temp/jdbc-driver.jar
AdminConfig.checkin(dest, file, digest)
AdminNodeManagement.syncActiveNodes()


来源:https://stackoverflow.com/questions/6666231/script-interface-to-install-an-arbitrary-files-to-all-nodes-in-websphere

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!