Centos 6.3 x86_64, Oracle JDK 6u35 (glassfish1 is master broker):
*glassfish1:* ssh test_at_glassfish1.corp.local sudo su - /etc/init.d/iptables
save /etc/init.d/iptables stop chkconfig iptables off nano /etc/hosts Add
glassfish1 and glassfish2 hosts adduser glassfish passwd glassfish chown -Rf
glassfish:glassfish /opt/glassfish3 chmod 755 /etc/init.d/glassfish chkconfig
--add glassfish chkconfig --level 234 glassfish on chkconfig --list glassfish
exit exit *glassfish2:* ssh test_at_glassfish2.corp.local sudo su -
/etc/init.d/iptables save /etc/init.d/iptables stop chkconfig iptables off
nano /etc/hosts Add glassfish1 and glassfish2 hosts adduser glassfish passwd
glassfish chown -Rf glassfish:glassfish /opt/glassfish3 chmod 755
/etc/init.d/glassfish chkconfig --add glassfish chkconfig --level 234
glassfish on chkconfig --list glassfish exit exit ssh
glassfish_at_glassfish2.corp.local cd /opt/glassfish3/bin ./asadmin start-domain
domain1 change-admin-password --domain_name domain1 enable-secure-admin
--port 4848 restart-domain domain1 *glassfish1:* ssh
glassfish_at_glassfish1.corp.local cd /opt/glassfish3/bin ./asadmin setup-ssh
glassfish1.corp.local glassfish2.corp.local start-domain domain1
change-admin-password --domain_name domain1 enable-secure-admin --port 4848
restart-domain domain1 create-cluster mascluster create-node-ssh --nodehost
glassfish1.corp.local --installdir /opt/glassfish3 glassfish1 create-node-ssh
--nodehost glassfish2.corp.local --installdir /opt/glassfish3 glassfish2
configure-jms-cluster --clustertype=conventional
--configstoretype=masterbroker mascluster create-instance --node glassfish1
--cluster mascluster masinstance1 create-instance --node glassfish2 --cluster
mascluster masinstance2 start-cluster mascluster list-nodes-ssh exit su -s
/bin/sh -l glassfish -c "/opt/glassfish3/mq/bin/imqcmd -b
glassfish1.corp.local:27676 list bkr" Add connection factories to cluster Add
destinations to cluster Deploy ear with test MDB via UI to cluster Test ORB
at 23700 and JMS mapper at 27676 on both servers /etc/init.d script (for
master, second instance the same except for start/stop cluster): #!/bin/bash
# # Startup script for GlassFish 3.1.2.2 # # chkconfig: 234 80 20 #
description: GlassFish Server Open Source Edition # processname: glassfish
### BEGIN INIT INFO # Provides: glassfish # Required-Start: $network $syslog
# Required-Stop: $network $syslog # Default-Start: # Default-Stop: #
Short-Description: GlassFish Server # Description: GlassFish Server Open
Source Edition ### END INIT INFO export JAVA_HOME=/usr/java/default
GLASSFISH_HOME=/opt/glassfish3/glassfish case $1 in start) if [[ -z
$(/sbin/pidof java) ]]; then echo "Starting GlassFish" /bin/su -s /bin/sh -l
glassfish -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1" /bin/su -s
/bin/sh -l glassfish -c "$GLASSFISH_HOME/bin/asadmin --user admin
--passwordfile=/opt/glassfish3/glassfish/domains/domain1/config/admin-password.txt
start-cluster mascluster" touch /var/lock/subsys/glassfish else echo
"GlassFish already running" fi ;; stop) if [[ ! -z $(/sbin/pidof java) ]];
then echo "Stopping GlassFish" /bin/su -s /bin/sh -l glassfish -c
"$GLASSFISH_HOME/bin/asadmin --user admin
--passwordfile=/opt/glassfish3/glassfish/domains/domain1/config/admin-password.txt
stop-cluster mascluster" /bin/su -s /bin/sh -l glassfish -c
"$GLASSFISH_HOME/bin/asadmin stop-domain domain1" until [[ -z $(/sbin/pidof
java) ]]; do :; done rm -f /var/lock/subsys/glassfish else echo "GlassFish
not running" fi ;; esac exit 0 First scenario, shut down master broker with
script above. This kills the ORB listeners on glassfish2. Second scenario
power off VM without stopping master broker, ORB still running on glassfish2.
Connection takes a while and send message to queue, but MDB never picks it
up. If both instances are running everything works as expected.
--
[Message sent by forum member 'sgjava']
View Post: http://forums.java.net/node/893206