环境:JBoss EAP 6.4.0 + RHEL 6.6 + EWS Httpd 2.1.0
安装和配置好Apache Httpd Server 和 mod_cluster后,就可以为JBoss EAP 配置负载均衡了。
1. Standalone Mode 集群下的负载均衡配置
(1)确定Apache Httpd Server所在机器的IP 地址,比如:192.168.56.101
(2)修改node1的配置文件如下:
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp" proxy-list="192.168.56.101:80" balancer="myBalancer">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
(3)node2的配置文件和node1做一样的修改
(4)启动node1,这里必须指定node1所在的机器的IP地址,比如:192.168.56.1
./standalone.sh -Djboss.server.base.dir=/Users/maping/Redhat/eap/demo/node1 -c standalone-ha-mod_cluster.xml -b 192.168.56.1 -bmanagement 192.168.56.1 -u 239.255.100.100 -Djboss.socket.binding.port-offset=100 -Djboss.node.name=node1
(5)启动node2,这里必须指定node2所在的机器的IP地址,比如:192.168.56.1
./standalone.sh -Djboss.server.base.dir=/Users/maping/Redhat/eap/demo/node2 -c standalone-ha-mod_cluster.xml -b 192.168.56.1 -bmanagement 192.168.56.1 -u 239.255.100.100 -Djboss.socket.binding.port-offset=200 -Djboss.node.name=node2
(6)访问http://192.168.56.1:8180/cluster_test
(7)访问http://192.168.56.1:8280/cluster_test
(8)访问http://192.168.56.101/cluster_test,做负载均衡测试。
2. Domain Mode 集群下的负载均衡配置
(1)cp machine1/domain/configuration/domain.xml machine1/domain/configuration/domain-mod_cluster.xml
(2)修改domain-mod_cluster.xml
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp" proxy-list="192.168.56.101:80" balancer="myBalancer">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
(3)启动machine1, 这里必须指定machine1所在的机器的IP地址,比如:192.168.56.1
./domain.sh -Djboss.domain.base.dir=/Users/maping/Redhat/eap/demo/machine1/domain/ --domain-config=domain-mod_cluster.xml --host-config=host-master.xml -b 192.168.56.1 -bmanagement 192.168.56.1
(4)启动machine2, 这里必须指定machine2所在的机器的IP地址,比如:192.168.56.1
./domain.sh -Djboss.domain.base.dir=/Users/maping/Redhat/eap/demo/machine2/domain/ --host-config=host-slave.xml -b 192.168.56.1 -Djboss.management.native.port=19999 -Djboss.domain.master.address=192.168.56.1
(5)启动machine3, 这里必须指定machine3所在的机器的IP地址,比如:192.168.56.1
./domain.sh -Djboss.domain.base.dir=/Users/maping/Redhat/eap/demo/machine3/domain/ --host-config=host-slave.xml -b 192.168.56.1 -Djboss.management.native.port=29999 -Djboss.domain.master.address=192.168.56.1
(6)访问http://192.168.56.1:8230/cluster_test
(7)访问http://192.168.56.1:9080/cluster_test
(8)访问http://192.168.56.101/cluster_test,做负载均衡测试。
安装和配置好Apache Httpd Server 和 mod_cluster后,就可以为JBoss EAP 配置负载均衡了。
1. Standalone Mode 集群下的负载均衡配置
(1)确定Apache Httpd Server所在机器的IP 地址,比如:192.168.56.101
(2)修改node1的配置文件如下:
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp" proxy-list="192.168.56.101:80" balancer="myBalancer">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
(3)node2的配置文件和node1做一样的修改
(4)启动node1,这里必须指定node1所在的机器的IP地址,比如:192.168.56.1
./standalone.sh -Djboss.server.base.dir=/Users/maping/Redhat/eap/demo/node1 -c standalone-ha-mod_cluster.xml -b 192.168.56.1 -bmanagement 192.168.56.1 -u 239.255.100.100 -Djboss.socket.binding.port-offset=100 -Djboss.node.name=node1
(5)启动node2,这里必须指定node2所在的机器的IP地址,比如:192.168.56.1
./standalone.sh -Djboss.server.base.dir=/Users/maping/Redhat/eap/demo/node2 -c standalone-ha-mod_cluster.xml -b 192.168.56.1 -bmanagement 192.168.56.1 -u 239.255.100.100 -Djboss.socket.binding.port-offset=200 -Djboss.node.name=node2
(6)访问http://192.168.56.1:8180/cluster_test
(7)访问http://192.168.56.1:8280/cluster_test
(8)访问http://192.168.56.101/cluster_test,做负载均衡测试。
2. Domain Mode 集群下的负载均衡配置
(1)cp machine1/domain/configuration/domain.xml machine1/domain/configuration/domain-mod_cluster.xml
(2)修改domain-mod_cluster.xml
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp" proxy-list="192.168.56.101:80" balancer="myBalancer">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
(3)启动machine1, 这里必须指定machine1所在的机器的IP地址,比如:192.168.56.1
./domain.sh -Djboss.domain.base.dir=/Users/maping/Redhat/eap/demo/machine1/domain/ --domain-config=domain-mod_cluster.xml --host-config=host-master.xml -b 192.168.56.1 -bmanagement 192.168.56.1
(4)启动machine2, 这里必须指定machine2所在的机器的IP地址,比如:192.168.56.1
./domain.sh -Djboss.domain.base.dir=/Users/maping/Redhat/eap/demo/machine2/domain/ --host-config=host-slave.xml -b 192.168.56.1 -Djboss.management.native.port=19999 -Djboss.domain.master.address=192.168.56.1
(5)启动machine3, 这里必须指定machine3所在的机器的IP地址,比如:192.168.56.1
./domain.sh -Djboss.domain.base.dir=/Users/maping/Redhat/eap/demo/machine3/domain/ --host-config=host-slave.xml -b 192.168.56.1 -Djboss.management.native.port=29999 -Djboss.domain.master.address=192.168.56.1
(6)访问http://192.168.56.1:8230/cluster_test
(7)访问http://192.168.56.1:9080/cluster_test
(8)访问http://192.168.56.101/cluster_test,做负载均衡测试。
没有评论:
发表评论