我正在尝试使以下设置正常工作:
操作系统:Ubuntu 14.04.3 LTS Apache2:Apache/2.4.7 (Ubuntu) mod_cluster 1.3.1 wildfly:wildfly-10.0.0.CR2 域模式(主服务器组中的服务器一和其他服务器中的服务器二-group 在同一 ubuntu 服务器上)测试部署:cluster-demo
2 周后,我让 apache 与 mod_cluster 一起工作,但 wildfly 没有按预期工作。
我的阿帕奇配置:
启用站点/wildfly.conf
Listen 80
<VirtualHost *:80>
ServerAdmin info@domain.de
ServerName myserver.com
ServerAlias www.myserver.com
ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / balancer://mycluster
ProxyPreserveHost On
<Location />
Order deny,allow
Allow from All
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
启用站点/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ProxyPass / ajp://host:8009/
ProxyPassReverse / ajp://host:8009/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
mods-enabled/mod_cluster.conf
CreateBalancers 1
<IfModule manager_module>
Listen host:10001
ManagerBalancerName myclustern
<VirtualHost host:10001>
KeepAliveTimeout 300
MaxKeepAliveRequests 0
AdvertiseFrequency 5
ServerAdvertise On http://host:10001
EnableMCPMReceive
AdvertiseGroup 224.0.1.105:23364
<Location />
Order deny,allow
Deny from all
Allow from all
Require all granted
</Location>
<Location /mod_cluster-manager>
SetHandler mod_cluster-manager
Order deny,allow
Deny from all
Allow from all
</Location>
</VirtualHost>
</IfModule>
mods-enabled/mod_cluster.load
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
LoadModule cluster_slotmem_module /usr/lib/apache2/modules/mod_cluster_slotmem.so
LoadModule manager_module /usr/lib/apache2/modules/mod_manager.so
LoadModule proxy_cluster_module /usr/lib/apache2/modules/mod_proxy_cluster.so
LoadModule advertise_module /usr/lib/apache2/modules/mod_advertise.so
mod_cluster-manager 可用,cluster-demo 的演示页面也可用。但是 apache 错误日志显示以下错误:
[Mon Oct 19 21:18:34.798472 2015] [proxy:error] [pid 30588:tid 139836923037440] (111)Connection refused: AH00957: ajp: attempt to connect to host:27233 (host) failed
[Mon Oct 19 21:18:34.798523 2015] [proxy:error] [pid 30588:tid 139836923037440] AH00959: ap_proxy_connect_backend disabling worker for (host) for 60s
[Mon Oct 19 21:18:44.799481 2015] [proxy:error] [pid 30588:tid 139836902057728] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:18:54.800456 2015] [proxy:error] [pid 30588:tid 139836881078016] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:04.801415 2015] [proxy:error] [pid 30588:tid 139836870588160] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:14.802499 2015] [proxy:error] [pid 30589:tid 139836755199744] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:24.803463 2015] [proxy:error] [pid 30589:tid 139836744709888] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:34.804541 2015] [proxy:error] [pid 30588:tid 139836849608448] (111)Connection refused: AH00957: ajp: attempt to connect to host:27233 (host) failed
[Mon Oct 19 21:19:34.804602 2015] [proxy:error] [pid 30588:tid 139836849608448] AH00959: ap_proxy_connect_backend disabling worker for (host) for 60s
[Mon Oct 19 21:19:44.805589 2015] [proxy:error] [pid 30589:tid 139837055608576] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:54.806578 2015] [proxy:error] [pid 30589:tid 139837045118720] AH00940: ajp: disabled connection for (host)
当我从主服务器组服务器二停止服务器一时说,
(Incoming-2,ee,master:server-two) ISPN000094: 收到频道 web 的新集群视图: [master:server-two|12] (1) [master:server-two]
但在浏览器中,我得到的不是集群演示页面:
Service unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
我的 wildfly domain.xml 配置是来自服务器的标准配置,除了这两个 chanches:
<socket-binding-groups>
<socket-binding-group name="full-ha-sockets" default-interface="public">
...
<outbound-socket-binding name="mc-prox1">
<remote-destination host="host" port="10001"/>
</outbound-socket-binding>
</socket-binding-group>
</socket-binding-groups>
和
<subsystem xmlns="urn:jboss:domain:modcluster:2.0">
<mod-cluster-config advertise-socket="modcluster" proxies="mc-prox1" sticky-session="true" sticky-session-remove="false" sticky-session-force="false" connector="ajp">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
对于 apache 来说 000-default.conf 是必需的吗?如果我删除 proxypass 和 proxypassreverse 注释,我将无法访问演示页面。为什么我需要 wildfly 中的代理注释来让 apache 运行?广告模块有问题吗?
希望有人能帮助我。