![对于 JBoss AS 7.1.1 集群,mod_cluster 报告“MEM:无法读取节点”和“所有工作程序都处于错误状态”](https://linux22.com/image/612266/%E5%AF%B9%E4%BA%8E%20JBoss%20AS%207.1.1%20%E9%9B%86%E7%BE%A4%EF%BC%8Cmod_cluster%20%E6%8A%A5%E5%91%8A%E2%80%9CMEM%EF%BC%9A%E6%97%A0%E6%B3%95%E8%AF%BB%E5%8F%96%E8%8A%82%E7%82%B9%E2%80%9D%E5%92%8C%E2%80%9C%E6%89%80%E6%9C%89%E5%B7%A5%E4%BD%9C%E7%A8%8B%E5%BA%8F%E9%83%BD%E5%A4%84%E4%BA%8E%E9%94%99%E8%AF%AF%E7%8A%B6%E6%80%81%E2%80%9D.png)
我正在尝试在 apache2 代理上使用 mod_cluster 在域模式下配置 JBoss AS 7.1.1 集群。所有主机都运行 Ubuntu 并且是 Rackspace 云服务器。
我的问题是,当我点击我的应用程序时http://project.example.com/我刚刚收到 503
JBoss 日志报告:
org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Error [MEM: MEM: Can't read node: {4}] sending command STATUS to proxy proxy-ip/proxy-ip:6666, configuration will be reset
mod_cluster管理页面包含以下信息:
DUMP 输出
balancer: [1] Name: main-server-group Sticky: 1 [JSESSIONID]/[jsessionid] remove: 0 force: 0 Timeout: 0 maxAttempts: 1
node: [1:1],Balancer: main-server-group,JVMRoute: slave:server-two,LBGroup: [],Host: project-jb-node1,Port: 8159,Type: ajp,flushpackets: 0,flushwait: 10,ping: 10,smax: 26,ttl: 60,timeout: 0
node: [2:2],Balancer: main-server-group,JVMRoute: master:server-one,LBGroup: [],Host: project-jb-master,Port: 8009,Type: ajp,flushpackets: 0,flushwait: 10,ping: 10,smax: 26,ttl: 60,timeout: 0
node: [3:3],Balancer: main-server-group,JVMRoute: master:server-two,LBGroup: [],Host: project-jb-master,Port: 8159,Type: ajp,flushpackets: 0,flushwait: 10,ping: 10,smax: 26,ttl: 60,timeout: 0
node: [4:4],Balancer: main-server-group,JVMRoute: slave:server-one,LBGroup: [],Host: project-jb-node1,Port: 8009,Type: ajp,flushpackets: 0,flushwait: 10,ping: 10,smax: 26,ttl: 60,timeout: 0
信息输出:
Node: [1],Name: slave:server-two,Balancer: main-server-group,LBGroup: ,Host: project-jb-node1,Port: 8159,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 26,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100
Node: [2],Name: master:server-one,Balancer: main-server-group,LBGroup: ,Host: project-jb-master,Port: 8009,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 26,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100
Node: [3],Name: master:server-two,Balancer: main-server-group,LBGroup: ,Host: project-jb-master,Port: 8159,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 26,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100
Node: [4],Name: slave:server-one,Balancer: main-server-group,LBGroup: ,Host: project-jb-node1,Port: 8009,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 26,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100
重新启动后,apache error.log 包含:
[Sun May 26 19:17:51 2013] [notice] Apache/2.2.22 (Ubuntu) mod_cluster/1.2.0.Final configured -- resuming normal operations
[Sun May 26 19:17:52 2013] [warn] manager_handler STATUS error: MEM: Can't read node
[Sun May 26 19:17:53 2013] [warn] manager_handler STATUS error: MEM: Can't read node
[Sun May 26 19:17:55 2013] [warn] manager_handler STATUS error: MEM: Can't read node
[Sun May 26 19:18:00 2013] [warn] manager_handler STATUS error: MEM: Can't read node
[Sun May 26 19:18:26 2013] [error] proxy: CLUSTER: (balancer://main-server-group). All workers are in error state
如果我打http://project.example.com/index.html我在 apache error.log 中收到此信息:
[Sun May 26 19:34:33 2013] [warn] proxy: No protocol handler was valid for the URL /index.html. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
主机名(project-jb-master
etc)映射到 /etc/hosts 中的 IP,我可以使用 telnet 连接并可以 ping 通。
通过 Google 搜索我发现很多关于 instance-id 的提及所以我在 full-ha 配置文件中设置了它:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" instance-id="${jboss.node.name}" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<alias name="project.example.com"/>
</virtual-server>
</subsystem>
但原始消息仍然存在。
答案1
目前,Rackspace 云服务器不允许多播。多播流量最终会导致交换层过载,并降低所有流量的网络性能。
因此,配置应该看起来像这样:
Apache 配置:
Listen host:6666
<VirtualHost host:6666>
EnableMCPMReceive
<Location /mod_cluster-manager>
SetHandler mod_cluster-manager
</Location>
</VirtualHost>
ServerAdvertise 未启用
JBoss 配置:
<subsystem xmlns="urn:jboss:domain:modcluster:1.1">
<mod-cluster-config advertise="false" connector="ajp" proxy-list="host:6666">
...
</mod-cluster-config>
</subsystem>
代理列表
定义此节点最初将与之通信的 httpd 代理的逗号分隔列表。值应采用以下格式:
address1:port1,address2:port2
广告
使用默认配置,可以通过jboss.mod_cluster.proxyList
系统属性来操作此属性。
如果启用,httpd 代理将通过多播公告自动发现。这可以协同使用,也可以代替静态代理列表。
答案2
将 Apache HTTP 服务器设置为 LogLevel debug。然后您将能够在 error_log 中看到 AS7 实例发送了哪些消息。此外,更新至 mod_cluster 1.2.6。它与 1.2.4 完全向后兼容,并且包含大量重要的错误修复。
答案3
代理:没有对 URL /index.html 有效的协议处理程序。如果您使用的是 mod_proxy 的 DSO 版本,请确保使用 LoadModule 将代理子模块包含在配置中。
确保您已经加载 mod_proxy_http 和/或 mod_proxy_ajp。