apache - Jboss Mod_cluster

标签 apache jboss mod-cluster

我有一个 jboss 集群,有 2 个节点(a 和 b)+ 1 个 apache 作为 mod_cluster(apache 在单独的服务器中)

如果其中一个nodeA出现故障,mod集群将无法连接到另一个nodeA。

所以,如果nodeA崩溃,我无法通过http://apache_server/myapp访问jboss应用程序,但我可以通过http://nodeb/myapp反之亦然

我在谷歌上挖掘了几乎所有我发现的与 session 相关的内容,但我找不到我的配置有什么问题。 (使用此工具配置的 Mod_cluster Load Balancer Configuration Tool

节点A日志

15/05/2016 07:45:22,741 ERROR [org.jgroups.protocols.TCP] (http-/nodeA:8080-90) failed sending message to jbossnodeb:jbossnodeb/web (4148 bytes): java.net.SocketException: Socket closed, cause: null
15/05/2016 07:45:22,790 ERROR [org.jgroups.protocols.TCP] (OOB-6464,shared=tcp) failed sending message to jbossnodeb:jbossnodeb/web (4141 bytes): java.net.SocketException: Broken pipe, cause: null

节点日志

15/05/2016 07:45:23,126 ERROR [org.jgroups.protocols.TCP] (OOB-4949,shared=tcp) failed sending message to jbossnodea:jbossnodea/web (79 bytes): java.net.SocketException: Broken pipe, cause: null
15/05/2016 07:45:53,457 WARN  [org.jgroups.protocols.TCP] (Timer-1,shared=tcp) null: no physical address for jbossnodea:jbossnodea/web, dropping message

Apache mod_cluster 服务器日志

[Sun May 15 07:45:04 2016] [error] (70007)The timeout specified has expired: proxy: read response failed from (null) (nodeA_IP)
[Sun May 15 07:45:34 2016] [error] (70007)The timeout specified has expired: ajp_cping_cpong: apr_socket_recv failed
[Sun May 15 07:45:38 2016] [error] ajp_handle_cping_cpong: ajp_ilink_receive failed
[Sun May 15 07:45:38 2016] [error] (70007)The timeout specified has expired: proxy: AJP: cping/cpong failed to (null) (nodeA_IP)
[Sun May 15 07:45:44 2016] [error] (70007)The timeout specified has expired: ajp_cping_cpong: apr_socket_recv failed
[Sun May 15 07:45:44 2016] [error] (70007)The timeout specified has expired: proxy: dialog to nodeA_IP:8009 (nodeA_IP) failed
[Sun May 15 07:45:44 2016] [error] ajp_read_header: ajp_ilink_receive failed
[Sun May 15 07:45:44 2016] [error] (70007)The timeout specified has expired: proxy: dialog to nodeA_IP:8009 (nodeA_IP) failed
[Sun May 15 07:45:44 2016] [error] (70007)The timeout specified has expired: proxy: dialog to nodeA_IP:8009 (nodeA_IP) failed
[Sun May 15 07:45:45 2016] [error] ajp_read_header: ajp_ilink_receive failed
[Sun May 15 07:45:45 2016] [error] (70007)The timeout specified has expired: proxy: dialog to (null) (nodeA_IP) failed
[Sun May 15 07:45:45 2016] [error] ajp_read_header: ajp_ilink_receive failed
[Sun May 15 07:45:45 2016] [error] (70007)The timeout specified has expired: proxy: dialog to (null) (nodeA_IP) failed
[Sun May 15 07:45:45 2016] [error] ajp_read_header: ajp_ilink_receive failed
[Sun May 15 07:45:45 2016] [error] proxy: CLUSTER: (balancer://clusterjboss). All workers are in error state

配置apache mod_cluster

AdvertiseGroup 225.0.1.107:23364
KeepAliveTimeout 60
ManagerBalancerName clusterjboss
ServerAdvertise On
AdvertiseFrequency 5
EnableMCPMReceive
CreateBalancers 0
AllowDisplay On

ProxyPass / balancer://clusterjboss/ stickysession=JSESSIONID|jsessionid nofailover=On

最佳答案

可见性

  • JBoss 工作实例必须能够联系您的“EnableMCPMReceive”虚拟主机
  • 您的 JBoss 工作线程实例将其 IP 地址和 AJP 端口报告给 Apache HTTP Server
  • 您的 Apache HTTP 服务器必须能够通过这些报告的地址与他们联系 代理通行证

JGroup、Infinispan、域、集群

mod_cluster,即 modcluster 子系统与上述内容无关。子系统完全忽略了以下事实:已形成某个集群或您的实例位于域中——这也与您的实例位于集群中无关。在调查 mod_cluster 配置时不要理会 JGroups 消息。

不过,如果您的 JGroups 集群损坏...

Infinispan - 即本例中 Web session 数据的分布式或复制缓存,依赖于 JGroups 来形成集群并在该集群中交换消息。如果您的实例无法用于集群或无法交换消息,您可能会在故障转移时遇到 session 数据丢失的情况。

例如:Apache HTTP Server mod_cluster balacner 决定将 JSESSIONID yadayadaXXX.worker-1 的请求发送到worker-2,因为worker-1 已关闭。由于网络配置错误,worker-1和worker-2从未正确形成集群,因此worker-2没有worker-1的 session 数据。结果是创建了一个新 session 的 Web 应用程序,即您的客户端丢失了他的上下文,例如购物车(流行展示)。

代理密码

除非您有特定的想法,否则不要使用它。 mod_cluster 的全部要点在于,它会在工作节点及其 Web 应用程序来来去去时动态地在内存中创建所有代理指令。如果您愿意,您可以开始摆弄其他 ProxyPass 指令:

  • 对来自特殊网络应用程序的特殊错误代码使用react,例如将应该表示错误的 HTTP 代码视为有效,反之亦然
  • 直接从 Apache HTTP Server 而不是从工作节点提供静态内容 - 例如图片...
  • 将某些上下文负载平衡到 mod_cluster 感知的 JBoss 工作节点,并将某些上下文负载平衡到非 mod_cluster 服务器,例如另一个在 PHP 中运行 Drupal 的 Apache HTTP 服务器...

ManagerBalancerName

我不清楚为什么您需要更改它。如果更改默认值,则还必须更改 Jboss modcluster 子系统配置中的 balancer="new_value"。它实际上的作用是告诉 Apache HTTP Server 中的 mod_cluster 在内部创建更多单独的命名 ProxyPass Balacner。然后可以使用 ProxyPass 指令来单独调整它们。你需要调整它们吗?根据您的其余配置,我确信情况并非如此。例如, session 粘性是在 mod_cluster 子系统的 JBoss 节点中配置的 - 工作人员会将其报告给 Apache HTTP Server 平衡器。

HTH,-K-

关于apache - Jboss Mod_cluster,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37284974/

相关文章:

apache - 在 AWS ebextensions 中执行命令

php - HTTPS 子域不断重定向到 HTTPS 主域

jboss - 有没有办法在使用 CLI 将模块添加到 JBoss 之前进行检查?

ssl - 当我使用 APR 并且并非所有 Web 部署都使用 CLIENT-CERT 身份验证时,如何在 JBoss 5.1.0.GA 中获得客户端证书身份验证?

apache -/bin/sh : 1: ./configure: 未找到 - dockerfile

php - 如何使用 PHP 获取服务器的本地 IP 地址?

java.lang.SecurityException : Cannot set up certs for trusted CAs (JBoss AS 7)

jboss - JBoss 中使用 mod_cluster 进行负载平衡

apache - 负载平衡集群不适用于 Apache HTTP Server 2.4.6 和 JBoss EAP 7