我正在尝试使用 mod_cluster 配置 WildFly 8.1.0。WildFly 和 Apache 都在同一台机器上运行。该机器是带有 Apache 2.2.x 的 Ubuntu 12.04
Apache 设置正确(我相信)。我通过运行 mod_proxy 源代码 (github) 中的测试类 Advertise 测试了广告模块是否正常工作。apache 日志中没有错误。
我按如下方式启动服务器:./standalone.sh -c Standalone-ha.xml
如果有人能看出下面的配置有问题并帮助我摆脱痛苦的日子,我将不胜感激......
阿帕奇配置
CreateBalancers 1
<IfModule manager_module>
#Listen 127.0.1.1:6666
Listen *:6666
ManagerBalancerName mycluster
<VirtualHost *:6666>
KeepAliveTimeout 300
MaxKeepAliveRequests 0
AdvertiseFrequency 5
ServerAdvertise On
AllowDisplay On
<Location />
Order deny,allow
Allow from 127.0.1
</Location>
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
Order deny,allow
#Deny from all
#Allow from 127.0.1
Allow from all
</Location>
</VirtualHost>
</IfModule>
虚拟主机配置
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / balancer://mycluster
ProxyPreserveHost On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Advertize 测试类的结果
received from /178.62.50.xxx:23364
received: HTTP/1.0 200 OK
Date: Sat, 26 Jul 2014 20:03:12 GMT
Sequence: 121
Digest: 4dedd3761d451227f36534b63ca2a8a1
Server: b23584e2-314f-404d-8fde-05069bfe5dc7
X-Manager-Address: 127.0.1.1:6666
X-Manager-Url: /b23584e2-314f-404d-8fde-05069bfe5dc7
X-Manager-Protocol: http
X-Manager-Host: 127.0.1.1
从 mod_cluster_manager (178.62.50.xxx:6666/mod_cluster_manager) 打印出来
mod_cluster/1.2.6.Final
start of "httpd.conf" configuration
mod_proxy_cluster.c: OK
mod_sharedmem.c: OK
Protocol supported: http AJP
mod_advertise.c: OK
Server: 127.0.1.1
Server: 127.0.1.1 VirtualHost: *:80
Server: 127.0.1.1 VirtualHost: *:6666 Advertising on Group 224.0.1.105 Port 23364 for http://127.0.1.1:6666 every 5 seconds
end of "httpd.conf" configuration
最后,这里是来自standalone-ha.xml 的相关部分
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
<socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
<interfaces>
<interface name="management">
<inet-address value="178.62.50.xxx"/>
</interface>
<interface name="public">
<inet-address value="127.0.1.1"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.1.1}"/>
</interface>
</interfaces>
服务器日志中唯一与 modcluster 相关的部分(服务器启动期间的输出)
15:53:29,805 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017519: Undertow HTTP listener default listening on /127.0.1.1:8080
15:53:29,811 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017519: Undertow AJP listener ajp listening on /127.0.1.1:8009
15:53:29,905 INFO [org.jboss.modcluster] (ServerService Thread Pool -- 54) MODCLUSTER000001: Initializing mod_cluster version 1.3.0.Final
15:53:29,967 INFO [org.jboss.modcluster] (ServerService Thread Pool -- 54) MODCLUSTER000032: Listening to proxy advertisements on /224.0.1.105:23364