Search This Blog

Monday, November 15, 2010

WebLogic domain migration made easy by WLST

Huge migrations will be done in short time with wise WLST tricks. Now every one thinking about visualization of Cloud computing, that impacts on Oracle FMW components and also on WebLogic components. When there is hundreds of servers in build and deploy for a business there must be best practices that includes WLST automation with templatizing is must. This strategy will save lot of time, which consumes for configuring each system resource, user-defined resource on the WebLogic domain. The customized WebLogic domain templates can be used for the following situations:

This new feature is introduced from WebLogic 9.x onwards, we have wonderful options in WLST.
1. Default template to customized domain template
2. Existing Domain to customized domain template then domain
3. Domain Template from WebLogic 9.x to WebLogic 10.x domain and also supports this from WebLogic 10.x to WebLogic 11g migration process.
4. WebLogic Domain migrations from one machine to another

WebLogic Domain migration with WLST


Let me explain my current experiment on creating new WebLogic 11g Domain from existing WebLogic 9.2 domain which we did successfully in UAT, staging and finally in live too. The basic steps I followed in offline are as :
1. creating template: readDomain() from the existing WebLogic 9.2 and create a domain template with writeTemplate().
2. configuring new domain: go to the destination machine and readTemplate(), writeDomain()
3. updating for new domain: readDomain() and then modify the ListenAddress, ListenPort, security settings, and Log details for the domain
4. after making all required changes use updateDomain()

468x60
Big Advantage of Domain Templates using WLST

This will reduce the pain of creating
1. DataSource
3. Multi DataSource
4. JMS module
5. Persistence store
6. Start scripts
7. Domain environment automatically updated

Configure new domain templates


A domain configured from an existing development server to new machine. all the domain files are hoped to new machine, but certain parameters dependent on the local configurations. Such as listen address for the admin server, here is the need of WLST in offline mode to rectify the current environment. readDomain() is the WLST command that gives the access to current configuration and reproduce that domain template with writeTemplate().

Source machine:
readDomain('/home/domains/olddomain')
writeTemplate('/home/templatepath/olddomain.jar')
closeDomain()

Configuring new Domain on migrating machine

Now you can copy this template olddomain.jar file to destination machine and copy to the destination location. Execute following offline command sequence as follows:
createDomain('/olddoamin/path/template.jar’,’domainPath’,’user’, ‘passwd’)

Extending a Domain with WLST

To an existing domain you can change the few parameters regularly this you can give in a separate properties file. Create a simple script when you run the WLST script it will impacted in the new domain for extending with new properties this could be a best practice. For further updates you need to update one of the parameter that will make all the environment scripts updated for this new domain with new environment, So don't forget to update one of these following values:

readTemplate('/home/templatepath/olddomain.jar')
writeDomain('/home/domains/newdomain')
closeTemplate()
readDomain('/home/domains/newdomain')
ls()
cd('Server')
ls()
cd('AdminServer')
set('ListenAddress','hostname.com')
set('ListenPort',10300) # Changing Admin Server ListenPort
set('Name','newAdmin') # Changing Admin server name

cd('/Server/newAdmin/Log/newAdmin')
set('FileName','/home/instances/newAdmin/logs/newAdmin.log')
updateDomain()
closeDomain()

Change to Production Mode
One of the situation that where you start working on developing complete platform designing for a Weblogic based environment such as SOA or WebCenter or some other. You might get situation where you need to change development mode to production mode. If your pre-production environtment is made exaactly simula of production then the only one thing you need to change that is Production Mode. This Production mode will give more security than development mode for WebLogic domain. Using WLST you can do this very easy to modify this
connect(adminUser,adminPassword,adminURL)
edit()
startEdit()

cd('/')

####################################################################################
# DOMAIN LEVEL CONFIGURATIONS
###################################################################################
print ' ******* SETTING DOMAIN LEVEL CONFIGURATIONS *********** '

domMode = getMBean('/')
domMode.setProductionModeEnabled(true)

domLog = getMBean("/Log/"+domainName)
domLog.setFileName(''+domainHome+'/logs/bea/'+domainName+'.log')

secCon = getMBean("/SecurityConfiguration/"+domainName)
secCon.setEnforceValidBasicAuthCredentials(false)

print ' ******* DOMAIN LEVEL CONFIGURATIONS SET SUCCESSFULLY *********** '
save()
activate(block="true")

disconnect()
The properties file be look like this:
adminUser=weblogic
adminPassword=weblogic123$
adminServerName=admin_cldom
adminServerListenaddr=localhost
admlistenport=7100

OverwriteDomain=true
domainName=cldom
domainHome=/wldomains/cldom
After running above script, you need to stop all the servers in the domain with the current domain configuration start the AdminServer first then start remaining managed servers. This will show the impact of change mode. One of my online buddy asked me is there any chance to migrate from non-WebLogic Application server(such as JBoss/WAS/OCJ4 etc) to WebLogic. Right now it is not available from Oracle, If Oracle give similar way of templates  for migrating from OCJ4 Application Server migration, Websphere migration, JBoss migration and TCat server migration templates then it is more easy life for migrating from any J2EE server to any other. This is a very marketing strategy because it can make more revenue for Oracle and it is easy for customers and WLA to migrate JEE applications to Oracle WebLogic Server. What do you say dear blog reader?? Keep writing your suggestions, comments.

11 comments:

  1. Hi,

    could you please help on what should be the strategy for moving a weblogic domain from solaris to linux.

    Currently, i have one domain with two managed servers in cluster running on
    solaris. we need to move to this linux.
    I heard pack and unpack command would be helpful. will it work in this suitation? what if we want to have different directory structure on linux box?
    2) for moving the users and groups details, will exporting from console and importing to linux work?

    Please help with guidance. I dont know what/how should i approach this domain move and we are not upgrading weblogic version

    Thank you,
    Jay

    ReplyDelete
  2. You can migrate the domain with above posted way also...

    What is your WebLogic version?
    Directory structure change doesnot matter, you need to update that same in your configurations also.

    Solaris to Linux only lib paths varies. user paths in when you updateDomain in WLST that automatically updated.

    ReplyDelete
  3. Do the same procedure works for upgrading weblogic 10MP1 to 12c?

    ReplyDelete
  4. offcourse it could work! for WebLogic 10g -> WebLogic 12c too. Because there is no much changes in the template related WLST definitions (def).

    ReplyDelete
  5. Hello Pawan, your post is really helpful... In my case I'm looking for something different. In our organization, we are migrating from 10.3.5 to 12.1.2...I could simply use the above steps but the problem Is we currently don't have Admin and managed server design...

    ReplyDelete
    Replies
    1. Hi Nitin, I didn't got your complete conversation. you mean there is simple single server domain? that contains only Admin server may be that is renamed? you can apply these steps as well.

      Delete
    2. Yes, single server domain(only Admin server having all the resources ) and we want to switch to Admin - managed server setup on new Linux server. I want to get the configuration of resources from old Admin server to new managed server. And we are also migrating from 10.3.5 to 12.1.2.

      Delete
  6. when u are extending the existing domain, what is need to use readTemplate(),writeDomain() methods?
    can't we do directly by using readDomain() method?

    ReplyDelete
  7. Thank you for making simple the process of weblogic domain migration and I follow your steps in my Weblogic Training and work.

    ReplyDelete
  8. what is need to use read Template(),write Domain() methods?
    can't we do directly by using read Domain() method?


    Oracle Weblogic Server Training

    ReplyDelete

  9. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly. I want to share about weblogic online training .

    ReplyDelete

Please write your comment here

Popular Posts