Tuesday 26 July 2011

Creating a domain using pack and unpack commands in weblogic

Creating Domain using pack and unpack

Though there are many ways to configuring a WebLogic domain, Here I am going to experiment with pack and unpack commands for my Certification. Later I found it is very handy for migrating old domains to new and it is best suites for extending the domains also.

You have one more chance of creating domain template with Domain Template Builder

http://download.oracle.com/docs/cd/E13179_01/common/docs102/tempbuild/index.html

 Create new domains using custom Domain/Configuration Templates

Creating Domain by using pack and unpack command of new feature in Weblogic Server 9.x and above 10g or 11g:

The WebLogic provides two compressing and uncompressing the domain for reusing to another remote machine or it can be used as backup for the existing domain.

Which requires the PATH need to set to /common/bin

export PATH=/export/home/wlsuser/bea/weblogic92/common/bin:$PATH

PACK Process

Now let us see PACK Process how it works

Syntax:

pack -domain=domain -template=template -template_name=“template_name”
[-template_author=“author”][-template_desc=“description”]
[-managed={true|false}][-log=log_file] [-log_priority=log_priority]

if it is in the pack command in the path you can give pack.sh from any directory otherwise you need to goto that path.
Example

bash-3.00$ pack.sh -domain="/export/home/wlsuser/domains/wlscldom"
-template="/export/home/wlsuser/templates/wlscltemp.jar" -template_name="WLS
CLUSTER DOMAIN" -log=/export/home/wlsuser/logs/wlscldompack.log -log_priority=INFO

<< read domain from "/export/home/wlsuser/domains/wlscldom" >> succeed: read domain from "/export/home/wlsuser/domains/wlscldom"
<< write template to "/export/home/wlsuser/templates/wlscltemp.jar" ................................................................................. ................... >> succeed: write template to "/export/home/wlsuser/templates/wlscltemp.jar"
<< close template >> succeed: close template

To confirm that domain created in the current directory check with ls command.
bash-3.00$ ls -l
total 30
drwxr-xr-x 8 wlsuser wlproj512 Dec 19 07:58 bea
drwxr-xr-x 3 wlsuser wlproj512 Dec 24 10:48 domains
bash-3.00$ cd logs
bash-3.00$ ls -l
total 130
-rw-r--r-- 1 wlsuser wlproj948 Dec 24 12:06 wlscldompack.log

To View the logged info related to pack process.
bash-3.00$ tail -100 wlscldompack.log
2008-12-24 12:06:43,569 INFO [runScript]
com.bea.plateng.domain.script.ScriptExecutor - read domain from
"/export/home/wlsuser/domains/wlscldom"
2008-12-24 12:06:52,643 INFO [runScript]
com.bea.plateng.domain.script.ScriptExecutor - succeed: read domain from
"/export/home/wlsuser/domains/wlscldom"
2008-12-24 12:06:52,648 INFO [runScript]
com.bea.plateng.domain.script.ScriptExecutor - write template to
"/export/home/wlsuser/templates/wlscltemp.jar"
2008-12-24 12:06:56,785 INFO [Thread-1] com.bea.plateng.domain.TemplateGenerator
- Template Generation Successfull!
2008-12-24 12:06:56,847 INFO [runScript]
com.bea.plateng.domain.script.ScriptExecutor - succeed: write template to
"/export/home/wlsuser/templates/wlscltemp.jar"
2008-12-24 12:06:56,852 INFO [runScript]
com.bea.plateng.domain.script.ScriptExecutor - close template
2008-12-24 12:06:56,856 INFO [runScript]
com.bea.plateng.domain.script.ScriptExecutor - succeed: close template


bash-3.00$ cd templates
bash-3.00$ ls -l
total 46
-rw-r--r-- 1 wlsuser wlproj 23188 Dec 24 12:06 wlscltemp.jar

To pack the managed servers only then we need to use the option '-managed=true'. by default it is set to false.
bash-3.00$ pack.sh -managed=true -domain="/export/home/wlsuser/domains/wlscldom"
-template="/export/home/wlsuser/templates/wlscltemp.jar" -template_name="WLS
CLUSTER DOMAIN" -log=/export/home/wlsuser/logs/wlscldompack.log -log_priority=INFO

UNPACK Process

To run this we must already run the pack command on a domain which is already existing. The domain template jar must be copied to the destination machine.

Syntax:
unpack -template=template -domain=domain [-user_name=username]
[-password=password] [-app_dir=application_directory]
[-java_home=java_home_directory] [-server_start_mode={dev|prod}]
[-log=log_file] [-log_priority=log_priority]

Example

bash-3.00$ unpack.sh -template=wlscltemp.jar -domain=domains/wlscldom
-log=wlscldomunpack.log -log_priority=INFO

<< read template from "/home/wlsuser/wlscltemp.jar" >> succeed: read template from "/home/wlsuser/wlscltemp.jar"
<< write Domain to "/home/wlsuser/domains/wlscldom" ................................................................................. .............. >> succeed: write Domain to "/home/wlsuser/domains/wlscldom"
<< close template >> succeed: close template
bash-3.00$ ls -l
total 1188090
drwxr-xr-x 7 wlsuser wlproj 1024 Dec 24 09:13 bea
drwxr-xr-x 3 wlsuser wlproj 96 Dec 24 12:20 domains

To unpack managed server also it will work in the similar manner. But need to put the “-managed=true”

Example:

pack.sh -managed=true -domain="/home/wluser/domains/WLclsnm/" -template="/home/wluser/templates/WLclsnm.jar" -template_name="WLS CLUSTER DOMAIN" -log=/home/wluser/logs/wlscldompack.log -log_priority=INFO


unpack.sh -template=WLclsnm.jar -domain=domains/WLclsnm -log=WLclsnmpack.log -log_priority=INFO 

No comments:

Post a Comment