JBOSS series-Server Load balancer,
To achieve Server Load balancer for each JBoss node, You need to configure a Server Load balancer in front of the cluster. The Server Load balancer serves as the portal for all requests and distributes requests to each node according to the defined load rules. Server Load balancer can achieve failover and status synchronization. I chose the popular Apache Http Server as the Load balancer in the cluster and communicated with the Jboss node through the mod_jk plug-in.
1. download binary files from the official website
Http://mod-cluster.jboss.org/downloads/1-2-6-Final-bin this has a variety of OS versions, this article uses windows as a test environment, should download the http://downloads.jboss.org/mod_cluster//1.2.6.Final/windows/mod_cluster-1.2.6.Final-windows-amd64.zip version
2. Unzip and install
Decompress the downloaded file to the Master Server. For example, extract it to C: \ mod-cluster.
2.1 run C: \ mod-cluster \ httpd-2.2 \ bin \ installconf. bat to generate default configuration 2.2 modify C: \ mod-cluster \ httpd-2.2 \ conf \ httpd. conf2.2.1 40 rows
<span style="font-size:14px;"><span style="font-size:14px;">#Listen 12.34.56.78:80Listen 80</span></span>
Change 8080 to 80 and remove the port number.
2.2.2 164 rows
<span style="font-size:14px;"><span style="font-size:14px;">ServerName 192.168.24.17:80</span></span>
Change to master Server ip Address
2.2.3 last part of the file
# MOD_CLUSTER_ADDS # Adjust to you hostname and subnet. <IfModule manager_module> Listen 192.168.24.17: 6666 ManagerBalancerName mycluster <VirtualHost 192.168.24.17: 6666> <Location/> Order deny, allow # Deny from all Allow from all </Location> KeepAliveTimeout 300 MaxKeepAliveRequests 0 # ServerAdvertise on http: // 127.0.0.1: 6666 AdvertiseFrequency 5 # AdvertiseSecurityKey secret # AdvertiseGroup 224.0.1.105: 23364 EnableMCPMReceive <Location/mod_cluster_manager> SetHandler mod_cluster-manager Order deny, allow # Deny from all Allow from all </Location> </VirtualHost> </IfModule> |
Note that the above marked red must be modified. Change the IP address to the IP address of the Master Server. Comment out two Deny from all. Change the row to Allow from all.
2.3 install httpd as a windows Service
Cmd command
Run the preceding two commands, that is, the registration is successful.
2.4 browsing
Access address: http: // 192.168.24.17: 6666/mod_cluster_manager
Note: I first open jboss in domain mode, so I can see many nodes. If not, I can only see the first node. If the configuration is successful, check whether the profile of the group created in the jboss master server is full-ha.
3. Server Load balancer
War has been deployed above, so you can directly use
Http: // 192.168.24.17/itoo-base-cgform-all/cgFormHeadController. do? CgFormHeadList # is accessed. apache intelligently forwards data to one of the six nodes. If the access is normal, the Server Load balancer has taken effect.
1) continue to stop several other servers and access http: // 192.168.24.42: 8083/itoo-base-cgform-all/cgFormHeadController. do? CgFormHeadList #
URL
Now, five are disabled. Visit the website to see the following:
2) If the node is still normal, it means that the failure of several nodes does not affect normal use, that is, fault tolerance is successful. After all the servers are turned off, they will not be able to access this URL.
Now all the six servers are turned off. Visit the URL:
Access failed. This indicates that the Server Load balancer has taken effect.
Summary
Server Load balancer solves the problem of high server pressure, so that the pressure on one server is distributed to each server. It shields user differences and makes Users unable to feel the existence of each server. From the user's point of view, it improves user availability, reduces maintenance costs, and improves maintainability.