Thursday 30 July 2015

Change Host, Cell and Node names.

 Seeing as the wsadmin command to rename a cell is not officially documented or supported, I have removed it from this post. I’m sorry, but it is for your own good!!
It seems like I get asked quite a bit about how to change node names and host names for a given WebSphere Application Server environment. It usually starts by someone asking me what configuration files they need to change when they want to update this information, and is followed by their surprise when I tell them none. The reason I say that is because it’s time consuming, hard, and unnecessary for you to figure this out. Instead, you can use two simple wsadmin commands. I’ll give you an example of those here (all written in Jython).
To change the name of a given node, use the following wsadmin command:
AdminTask.renameNode(‘[-nodeName <existing_node_name> -newNodeName <new_node_name>]’)
This updates the name of the node specified by the nodeNameparameter to the name specified by the newNodeName parameter.

To change the host name for a given node, use the following wsadmin command:
AdminTask.changeHostName(‘[-nodeName <node_name> -hostName <new_host_name>]’)
This updates the host name for the node specified in the nodeNameparameter to the value specified in the hostName parameter.

These commands update all of the necessary WAS configuration, but do keep in mind they do not update any shell or batch files in the environment. This means you need to update the setupCmdLine script included in your WAS installation, and you obviously need to update any of your custom scripts that have hard coded values for node and host names.

O/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin # ./wsadmin.sh -conntype NONE 
 -lang jython
WASX7357I: By request, this scripting client is not connected to any server process. 
 Certain configuration and application operations will be available in local mode.
WASX7031I: For help, enter: "print Help.help()"
wsadmin>

wsadmin>AdminTask.changeHostName ('[-interactive]')
Change Host Name

Change the host name of a node

*Node Name (nodeName): BhikshuCellManager01
*Host Name (hostName): new Host name
System Name (systemName): Bhikshu
Regenerate Certificates (regenDefaultCert): y

Change Host Name

F (Finish)
C (Cancel)

Select [F, C]: [F] F
WASX7278I: Generated command line: AdminTask.changeHostName
 ('[-nodeName BhikshuCellManager01 
 -hostName newhostname -systemName Bhikshu ]')
''
wsadmin>AdminConfig.save()
''
wsadmin>exit