JBoss Clustering

From Shrubbery

Jump to: navigation, search
Notes on JBoss Clustering

Contents

[edit] JBoss Clustering Configuration

System properties used for clustering:

PropertyDefaultFileDescription
jboss.partition.udpGroup
  • 230.1.2.3
  • 230.0.0.4 (in some cases)
  • cluster-service.xml
  • ejb3-entity-cache-service.xml
  • ejb3-clustered-sfsbcache-service.xml
  • jboss-messaging.sar/xxx-persistence-service.xml
  • jboss-web-cluster.sar/META-INF/jboss-service.xml
Same for all nodes in a given cluster. This is the multicast IP address that all cluster configurations will use. When running multiple clusters on the same LAN it is a good idea to use a different multicast IP address for each cluster. This avoids strange 'split brain' issues and warning messages from JGroups about messages from non-members.
jboss.partition.udpPort45566jmx-console.war/WEB-INF/web.xml
jboss.hapartition.mcast_port45566cluster-service.xml
jboss.ejb3entitypartition.mcast_port43333ejb3-entity-cache-service.xml
jboss.ejb3sfsbpartition.mcast_port45551ejb3-clustered-sfsbcache-service.xml
jboss.messaging.datachanneludpport45567jboss-messaging.sar/xxx-persistence-service.xml
jboss.messaging.controlchanneludpport45568jboss-messaging.sar/xxx-persistence-service.xml
jboss.webpartition.mcast_port45577jboss-web-cluster.sar/META-INF/jboss-service.xml

[edit] HA JNDI and local JNDI

Here are some usage scenarios that demonstrate the flexibility of having the clustered JNDI tree separate from the local JNDI tree:

ClientServer ResourceDescription
Servlet EJB Local Interface Servlets invoking EJBs will probably use local EJB interfaces most of the time. In this case, using the typical new InitialContext() approach to get the local JNDI tree is the best.
Remote JVM or Servlet acting like a remote JVM EJB Remote Interface If the EJB is clustered, then it will be available in the HA JNDI tree and the remote client should use that (port 1100 on each different by default). However, if the EJB is not clustered it's remote interface will be available just as it always was (port 1099 by default).
Servlet, MDB, or Remote JVM JMS destination
JBoss MQ
This is a little different than the other scenarios. When using HA JMS, all clients must look up the destinations in the HA JNDI tree! This is because the destinations and the JMS service itself are only deployed on one node of the cluster.
JBoss Messaging
When running a clustered post office, the topics/queues will be deployed on every node. Looking up the local destination works because the post offices will send messages to each other when required.

[edit] Networking Setup

JBoss uses JGroups extensively for clustering, and JGroups is typically configured to use multicast IP.

  • Use IPv4 on Linux - Make sure you specify -Djava.net.preferIPv4Stack=true, otherwise JGroups might not start up.
  • Explicitly specify the network interface - On Linux servers with multiple NICs, make sure you select a specific NIC. Otherwise, JGroups may not be able to select a unique 'address' for each node in the cluster.
  • Check firewalls - Make sure the firewalls and switches allow multi-cast IP on the server LAN.
  • Check for proper broadcast address - Make sure the BROADCAST address is set properly on the NICs.
    • Broadcast addresses are generally: x.y.z.255 where x.y.z is the subnet address.
    • All NICs used for the JBoss cluster should have the same broadcast address.


Example static IP address /etc/sysconfig/network-scripts/ifcfg-eth0:

#Primary ethernet interface
DEVICE=eth0
TYPE=Ethernet
IPADDR=192.168.0.101
BROADCAST=192.168.0.255
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
$ sudo /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:30:48:7D:8B:78  
          inet addr:192.168.0.101  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::230:48ff:fe7d:8b78/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25410626 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21474977 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:829760159 (791.3 MiB)  TX bytes:1099905746 (1.0 GiB)
          Interrupt:17 Base address:0xe000

[edit] Links

Personal tools