Now I remember doing this back in WAS V3 where it was necessary to update the underlying DB2 UDB database, via a SQL UPDATE command.
How the world has changed ...
The Information Centre here: -
describes how the Swiss Army Knife tool, wsadmin.sh, can be used to achieve the same ending.
Here are the steps that I followed: -
***CAUTION - THIS WILL POTENTIALLY BREAK YOUR WEBSPHERE ENVIRONMENT IF YOU DO IT WRONG***
Note that I've used the format wsadmin> to reflect that wsadmin has its own prompt and also used italics to indicate the commands that I typed
Change to the appropriate directory
cd /opt/IBM/WebSphere/AppServer/bin
Execute the wsadmin script ( this requires the server - be it server, node agent or deployment manager ) to be running - note the language is set to jython rather than the default JACL
wsadmin.sh -user wasadmin -password passw0rd -lang jython
Generate a listing showing the cell name
wsadmin> AdminConfig.list('ServerIndex')
-> this returns the path to the serverindex.xml - depending upon the environment, there may be more than one, as each node ( managed or unmanaged ) has one
-> in my case, this was (cells/cmwputCell01/nodes/cmwputCellManager01|serverindex.xml#ServerIndex_1)
Generate a listing showing the current hostname
wsadmin> AdminConfig.show('(cells/cmwputCell01/nodes/cmwputCellManager01|serverindex.xml#ServerIndex_1)', 'hostName')
-> this returns the hostname - in my case, this was '[hostName cmwput.uk.ibm.com]'
Change the hostname
wsadmin> AdminConfig.modify('(cells/cmwputCell01/nodes/cmwputCellManager01|serverindex.xml#ServerIndex_1)', "[[hostName cmwput.demo.uk.ibm.com]]")
-> note the really peculiar syntax, with a plethora of apostrophes, quotation marks, brackets and square brackets
Save the configuration
wsadmin> AdminConfig.save()
Generate a listing showing the current hostname
wsadmin> AdminConfig.show('(cells/cmwputCell01/nodes/cmwputCellManager01|serverindex.xml#ServerIndex_1)', 'hostName')
-> this returns the hostname - in my case, this was '[hostName cmwput.demo.uk.ibm.com]'
Restart WebSphere Application Server
Use the stop/startServer or stop/startNode or stop/startManager scripts as appropriate.
***CAUTION - THIS WILL POTENTIALLY BREAK YOUR WEBSPHERE ENVIRONMENT IF YOU DO IT WRONG***
A simple solution to a potentially complex problem.
Again, remember your mileage may, and almost certainly will, vary.
4 comments:
Hi ,
May i know how to change application server name change in webpshere applcaion server v7.0.I have cloned one server to other new server and also done all configuration changes like :node/cells/hostname.etc.
But doesn't change server name in websphere level. Kindly see the below path doesn't change new server name :
path:/config/cells/cellname/nodes/nodename/servers/
Hi Technology ( what a great name ! )
I've not had a need to do this, as I typically work in a WAS ND environment where it is easy to create new servers, migrate applications etc.
However, I did find this: -
How to rename an application server in WebSphere Application Server 6.0.2.23
and used the sample ConfigScripts to rename a single server within a managed cell.
I previously had a server called foobar in the AppSrv01 on the Node1 node, as seen here: -
ls /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/PCCell1/nodes/Node1/servers/
AppClusterMember1 foobar MEClusterMember1 nodeagent SupClusterMember1 webserver1
which I renamed as follows: -
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/ws_ant.sh -profileName AppSrv01 -buildfile ~/ConfigScripts/bin/exportImport.xml -logfile ~/rename.log -DoldServerName=foobar -DnewServerName=snafu -DnodeName=Node1 changeServerName
resulting in: -
AppClusterMember1 MEClusterMember1 nodeagent snafu SupClusterMember1 webserver1
Of course, I'm NOT advocating this solution, as it's not something that one needs to do. If you choose to use the sample scripts, please see the IBM license agreement, and consider the impact on a production environment e.g. backup, backup, backup, check backups etc.
PS For the record, I was using WAS 8.5.5.5, but I believe the scripts work on earlier versions of WAS.
Cheers, Dave
Hi!
I'm trying to change the IP address of a cloned server, should I follow these steps in order to make this change?
Thank you in advance!
Jesus
@Jesus
As long as WAS is configured to use a hostname rather than the IP address, there should be no need to update WAS if you're only changing the hostname.
Cheers, Dave
Post a Comment