Jboss Application Server Clustering Guide 4.2 Authors
Total Page:16
File Type:pdf, Size:1020Kb
JBoss Application Server Clustering Guide 4.2 Authors Brian Stansberry Galder Zamarreno ISBN: Publication date: JBoss Application Server Clus... This book is the Jboss Application Server clustering guide. JBoss Application Server Clustering Guide: Authors by Brian Stansberry, Galder Zamarreno, and Samson Kittoli JBoss Application Server Clus... 1. Clustering ...................................................................................................... 1 1. Introduction ........................................................................................... 1 2. Cluster Definition ................................................................................... 1 3. HAPartition ............................................................................................ 3 4. JBoss Cache channels .......................................................................... 4 4.1. Service Architectures .................................................................. 5 4.1.1. Client-side interceptor architecture ..................................... 5 4.1.2. Load balancer .................................................................. 7 4.2. Load-Balancing Policies .............................................................. 8 4.2.1. Client-side interceptor architecture ..................................... 9 4.2.2. External load balancer architecture .................................... 9 4.3. Farming Deployment ................................................................. 10 4.4. Distributed state replication services ........................................... 12 2. Clustered JNDI Services .............................................................................. 13 1. How it works ....................................................................................... 14 2. Client configuration .............................................................................. 16 2.1. For clients running inside the application server ........................... 16 2.2. For clients running outside the application server ......................... 17 2.3. JBoss configuration ................................................................... 19 3. Clustered Session EJBs ............................................................................... 23 1. Stateless Session Bean in EJB 2.x ....................................................... 23 2. Stateful Session Bean in EJB 2.x ......................................................... 24 2.1. The EJB application configuration .............................................. 24 2.2. Optimize state replication .......................................................... 25 2.3. The HASessionState service configuration .................................. 26 2.4. Handling Cluster Restart ............................................................ 26 2.5. JNDI Lookup Process ................................................................ 28 2.6. SingleRetryInterceptor ............................................................... 29 3. Stateless Session Bean in EJB 3.0 ....................................................... 29 4. Stateful Session Beans in EJB 3.0 ........................................................ 30 4. Clustered Entity EJBs .................................................................................. 35 1. Entity Bean in EJB 2.x ......................................................................... 35 2. Entity Bean in EJB 3.0 ......................................................................... 36 2.1. Configure the distributed cache .................................................. 36 2.2. Configure the entity beans for cache .......................................... 38 2.3. Query result caching ................................................................. 41 5. HTTP Services ............................................................................................ 45 1. Configuring load balancing using Apache and mod_jk ............................ 46 2. Download the software ......................................................................... 46 3. Configure Apache to load mod_jk ......................................................... 46 4. Configure worker nodes in mod_jk ........................................................ 48 5. Configuring JBoss to work with mod_jk ................................................. 50 6. Configuring HTTP session state replication ............................................ 51 7. Enabling session replication in your application ...................................... 53 v JBoss Application Server Clus... 8. Using FIELD level replication ................................................................ 55 9. Monitoring session replication ............................................................... 58 10. Using Clustered Single Sign On .......................................................... 59 11. Clustered Singleton Services .............................................................. 59 11.1. HASingletonDeployer service ................................................... 60 11.2. Mbean deployments using HASingletonController ...................... 61 11.3. HASingleton deployments using a Barrier ................................. 63 11.4. Determining the master node ................................................... 64 6. Clustered JMS Services ............................................................................... 67 1. High Availability Singleton Fail-over ...................................................... 67 1.1. Server Side Configuration .......................................................... 68 1.2. Non-MDB HA-JMS Clients ........................................................ 69 1.2.1. MDBs and HA-JMS Failover ........................................... 73 1.3. Load Balanced HA-JMS MDBs .................................................. 73 7. JBossCache and JGroups Services .............................................................. 75 1. JGroups Configuration ......................................................................... 75 2. Common Configuration Properties ........................................................ 78 3. Transport Protocols .............................................................................. 78 3.1. UDP configuration ..................................................................... 78 3.2. TCP configuration ..................................................................... 80 3.3. TUNNEL configuration ............................................................... 82 4. Discovery Protocols ............................................................................. 83 4.1. PING ........................................................................................ 83 4.2. TCPGOSSIP ............................................................................. 84 4.3. TCPPING ................................................................................. 85 4.4. MPING ..................................................................................... 85 5. Failure Detection Protocols ................................................................... 86 5.1. FD ........................................................................................... 86 5.2. FD_SOCK ................................................................................ 87 5.3. VERIFY_SUSPECT ................................................................... 87 5.4. FD versus FD_SOCK ................................................................ 88 6. Reliable Delivery Protocols ................................................................... 89 6.1. UNICAST ................................................................................. 89 6.2. NAKACK .................................................................................. 90 7. Other Configuration Options ................................................................. 90 7.1. Group Membership ................................................................... 91 7.2. Flow Control ............................................................................. 91 7.3. Fragmentation ........................................................................... 92 7.4. State Transfer ........................................................................... 93 7.5. Distributed Garbage Collection ................................................... 93 7.6. Merging .................................................................................... 94 7.7. Binding JGroups Channels to a particular interface ...................... 95 7.8. Isolating JGroups Channels ....................................................... 96 7.9. Changing the Group Name ........................................................ 97 vi 7.10. Changing the multicast address and port .................................. 97 7.11. JGroups Troubleshooting ......................................................... 98 7.12. Causes of missing heartbeats in FD ......................................... 99 vii viii Chapter 1. Clustering High Availability Enterprise Services via JBoss Clusters 1. Introduction Clustering allows us to run an application on several parallel servers (a.k.a cluster nodes) while providing a single view to application clients. Load is distributed across different servers, and even if one or more of the servers fails, the application is still accessible via the surviving cluster nodes. Clustering is crucial for scalable enterprise applications, as you can improve