Tuesday, April 6, 2010

JBOSS operations script

The scripts are tested on RHEL 5

start_jboss.sh (for clustered environment)
--------------------------------------------------------------------------
JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m
-Dorg.jboss.resolver.warning=true
-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000
-Dsun.lang.ClassLoader.allowArraySyntax=true"
JAVA_OPTS="$JAVA_OPTS {you can add your custom JVM / application properties here}"

MULTICAST_ADDR={specify multicast addr}
BIND_ADDR=`getip.sh`
PARTITION=appname-partition1
SERVER={specify profile name}
SERVER_PEER_ID=`getserverpeerid.sh`

$JBOSS_HOME/bin/run.sh -b $BIND_ADDR -c $SERVER -g $PARTITION -u $MULTICAST_ADDR -Djboss.messaging.ServerPeerID=$SERVER_PEER_ID $JAVA_OPTS
echo "JBOSS start operation completed"
--------------------------------------------------------------------------
Note: One of the reasons to pass JVM arguments in the startup script is because the same startup script can be used for all servers in the cluster. Any parameter change can be made in this single file. You can also specify it in run.conf but you might want to sync run.conf in all servers.

getip.sh 
--------------------------------------------------------------------------
grep IPADDR /etc/sysconfig/network-scripts/ifcfg-eth0  |awk -F= '{print $2}'
--------------------------------------------------------------------------

getserverpeerid.sh 
--------------------------------------------------------------------------
HOST=`cat /proc/sys/kernel/hostname`
echo ${HOST:(-2)}
--------------------------------------------------------------------------
Note: you can customize the script to provide a numeral server peer id. This script gets the last two digits of host name.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Newer›  ‹Older