I have configured a weblogic cluster that consists of two servers configured as migratable targets. This way I can use wlst
to migrate the services that run in one of the servers to the other with the command `migrate('serverX', 'serverX').
But before run migrate
command I'd like to check if each migratable target is running in its preferred server so I run migrate
only if needed.
Does anyone know how to check it?
Regards
You can definitely do this with wlst, here are some steps:
connect('weblogic','weblogic','http://myserver:7701')
cd('MigratableTargets')
ls() #this will list out all migratable objects
cd('<migratable name>')
ls('UserPreferredServer')
ls('HostingServer')
That will list your preferred server and the currently hosted server. You can use the current management object cmo
and check to see if they are equal:
cd('<migratable name>')
if(cmo.getUserPreferredServer() == cmo.getHostingServer())
...
migrate('serverX', 'servery')
You can see some of the calls that are available in the Oracle Weblogic API docs.