Tech

20121001

High Availability for WLS, How to Quickly pack/unpack copy the domain for testing.

We have a domain in which is in production, and you quickly need a testing domain with the same configuration. Since the production domain is in production, you cannot actually run the risk of messing things up. Therefore I am quickly writing this so it helps you on getting a copy of your domain quickly running for testing;

Navegate to your wls home:

1. [Middleware]$ cd 1036bin/wlserver_10.3/common/bin/

2. [bin]$ ls
commEnv.sh  config_builder.sh  config.sh  pack.sh  setPatchEnv.sh  startDerby.sh  startManagedWebLogic.sh  stopDerby.sh  unpack.sh  upgrade.sh  wlscontrol.sh  wlsifconfig.sh  wlst.sh

Use the pack command to build a template, here I am using the tmp directory:

3. [bin]$ ./pack.sh -domain=/home/Oracle/Domains/1036bin -template=/tmp/mydomain.jar -template_name="testingBackup"
<< read domain from "/home/Oracle/Domains/1036bin"
>>  succeed: read domain from "/home/Oracle/Domains/1036bin"
<< write template to "/tmp/mydomain.jar"
....................................................................................................
>>  succeed: write template to "/tmp/mydomain.jar"
<< close template
>>  succeed: close template

Unpack on a different directory, Actually the newDirectory does not exist the unpack will create one:

4. [bin]$ ./unpack.sh -template=/tmp/mydomain.jar -domain=/home/Oracle/newDirectory
<< read template from "/tmp/mydomain.jar"
>>  succeed: read template from "/tmp/mydomain.jar"
<< write Domain to "/home/Oracle/newDirectory"
...............................................................................................
>>  succeed: write Domain to "/home/Oracle/newDirectory"
<< close template
>>  succeed: close template

Goto the newly created newDirctory and start your backup domain:

5. [ bin]$ cd /home/Oracle/newDirectory

6. [newDirectory]$ ls
autodeploy  bin  config  console-ext  fileRealm.properties  fileRealm.properties.bak  init-info  lib  pending  security  servers  startManagedWebLogic_readme.txt  startWebLogic.sh  tmp

6. [ newDirectory]$ ./startWebLogic.sh
.
.
JAVA Memory arguments: -Xms512m -Xmx512m
.
WLS Start Mode=Development
.
.
.
<Oct 1, 2012 2:49:47 PM CLT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Oct 1, 2012 2:49:47 PM CLT> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>

This example was run into the same Linux machine, but if you want to transport this domains to a different machine you may just copy the mydomain.jar into the new machine, install the same WLS version and run the steps from 4 - 6 (While WLS installation you may choose the mydomian.jar as a template). This action is mainly use for extending domain into a remote machine, but also can be use to build testing environments with the same configuration as the production.

2 comments: