简体   繁体   English

Jboss Mod_cluster

[英]Jboss Mod_cluster

I have a jboss cluster with 2 nodes (a and b) + 1 apache working as mod_cluster (apache in a separate server) 我有一个jboss集群,有2个节点(a和b)+ 1个apache用作mod_cluster(apache在一个单独的服务器中)

If one of the nodeA goes down, mod cluster can't connect to another one. 如果其中一个节点A发生故障,则mod集群无法连接到另一个节点。

So, if nodeA crashes, I can't access jboss aplication by http://apache_server/myapp , but I can by http://nodeb/myapp and vice-versa 因此,如果nodeA崩溃,我无法通过http:// apache_server / myapp访问jboss应用程序,但我可以通过http:// nodeb / myapp反之亦然

I dig on google almost all i have found say that is related to sessions but I can't fnd whats is wron with my config. 我挖谷歌几乎所有我发现说与会话有关,但我不知道什么是wron与我的配置。 (Mod_cluster as configured with this tool Load Balancer Configuration Tool (使用此工具Load Balancer配置工具配置的Mod_cluster

NodeA Log NodeA日志

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

NodeB Log NodeB日志

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 server log 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

Config apache mod_cluster 配置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

Possible changes that need to be done in domain.xml: 可能需要在domain.xml中进行的更改:
1. Under < domain-controller>, add < remote host="< ip-address-of-master-node>" port="< port>" security-realm="ManagementRealm"/> 1.在<domain-controller>下,添加<remote host =“<ip-address-of-master-node>”port =“<port>”security-realm =“ManagementRealm”/>
2. Under < servers>, add < server name="slave-node" group="server-group" auto-start="true"> 2.在<servers>下,添加<server name =“slave-node”group =“server-group”auto-start =“true”>
3. Under mod-cluster subsystem, add < mod-cluster-config advertise-socket="modcluster" proxy-list="< ip-address>:< port-in-mod-cluster-config" connector="ajp"> 3.在mod-cluster子系统下,添加<mod-cluster-config advertise-socket =“modcluster”proxy-list =“<ip-address>:<port-in-mod-cluster-config”connector =“ajp”>

In mod-cluster configuration: 在mod-cluster配置中:
1. Allow from all 1.允许所有人
2. ManagerBalancerName server-group (exact name as above) 2. ManagerBalancerName服务器组(上面的确切名称)

Also, are you using any virtualization/containers? 另外,您使用的是虚拟化/容器吗? To deal problems with session replication in such cases, you might need to try out "sticky session". 要在这种情况下处理会话复制问题,您可能需要尝试“粘性会话”。

Visibility 能见度

  • JBoss worker instances must be able to contact your ```EnableMCPMReceive`` VirtualHost JBoss工作者实例必须能够联系你的```EnableMCPMReceive`` VirtualHost
  • Your JBoss worker instances report their IP address and AJP port to the Apache HTTP Server 您的JBoss工作器实例将其IP地址和AJP端口报告给Apache HTTP Server
  • Your Apache HTTP Server must be able to contact them back on those reported addresses ProxyPass 您的Apache HTTP Server必须能够在这些报告的地址ProxyPass上与他们联系

JGroups, Infinispan, Domains, Clustering JGroups,Infinispan,域名,集群

mod_cluster, ie modcluster subsystem has nothing to do with the aforementioned whatsoever . mod_cluster,即modcluster子系统与上述任何内容无关 The subsystem is completely oblivious to the fact that there is some cluster formed or that you have your instances in a domain -- which is also irrelevant to having your instances in a cluster in the first place. 子系统完全忽略了这样一个事实,即形成了一些集群或者您在域中拥有了您的实例 - 这与首先在集群中拥有实例无关。 Don't bother with JGroups messages while investigating mod_cluster configuration. 在研究mod_cluster配置时,不要打扰JGroups消息。

Although, if your JGroups cluster is broken... 虽然,如果你的JGroups集群坏了......

Infinispan - ie distributed or replicated cache of your web session data in this case, relies on JGroups for forming a cluster and for exchanging messages in this cluster. Infinispan(即在这种情况下,您的Web会话数据的分布式或复制缓存)依赖于JGroups来形成集群并在此集群中交换消息。 If your instances cannot for a cluster or fail to exchange messages, you might experience a loss of session data on failover. 如果您的实例无法用于群集或无法交换消息,则可能会在故障转移时丢失会话数据。

For example: Apache HTTP Server mod_cluster balacner decides to send request with JSESSIONID yadayadaXXX.worker-1 to worker-2, because worker-1 is down. 例如:Apache HTTP Server mod_cluster balacner决定使用JSESSIONID yadayadaXXX.worker-1向worker-2发送请求,因为worker-1已关闭。 Due to a network configuration error, worker-1 and worker-2 has never correctly formed a cluster, so worker-2 does not have the session data of worker-1. 由于网络配置错误,worker-1和worker-2从未正确形成集群,因此worker-2没有worker-1的会话数据。 The result is a web application with a new session created, ie your client lost his context, eg shopping cart (popular showcase). 结果是创建了新会话的Web应用程序,即您的客户端丢失了他的上下文,例如购物车(流行的展示)。

ProxyPass 的ProxyPass

Don't use it unless you have something specific in mind. 除非你有特定的东西,否则不要使用它。 The whole point of mod_cluster is that it creates all proxy directives in memory, on the fly dynamically as your worker nodes and their web applications come and go. mod_cluster的重点在于它会在工作节点及其Web应用程序来去时动态地动态创建内存中的所有代理指令。 You start fiddling with additional ProxyPass directives if you want to: 如果你想:你开始摆弄额外的ProxyPass指令:

  • react to special error codes from a special web applciation, eg to treat HTTP codes that are supposed to mean an error as valid and vice versa 对来自特殊Web应用程序的特殊错误代码做出反应,例如,将应该表示错误的HTTP代码视为有效,反之亦然
  • to serve static content directly from the Apache HTTP Server and not from worker nodes - eg pictures... 直接从Apache HTTP Server提供静态内容,而不是从工作节点提供 - 例如图片......
  • to load balance some contexts to mod_cluster-aware JBoss worker nodes and some contexts to non-mod_cluster servers, eg another Apache HTTP Server running Drupal in PHP... 将一些上下文负载平衡到mod_cluster-aware JBoss worker节点和一些上下文到非mod_cluster服务器,例如另一个在PHP中运行Drupal的Apache HTTP Server ...

ManagerBalancerName ManagerBalancerName

It is not clear to me why you would need to change it. 我不清楚为什么你需要改变它。 If you change the default value, you have to also alter balancer="new_value" in your Jboss modcluster subsystem configuration. 如果更改默认值,则还必须在Jboss modcluster子系统配置中更改balancer="new_value" What is actually does is that it tells mod_cluster in the Apache HTTP Server to create more separate named ProxyPass Balacners internally. 它的实际作用是告诉Apache HTTP Server中的mod_cluster在内部创建更多单独的命名ProxyPass Balacner。 One then could use ProxyPass directives to tweak them separately. 然后可以使用ProxyPass指令单独调整它们。 Do you need to tweak them? 你需要调整它们吗? According to the rest of your config I am convinced it is not the case. 根据配置的其余部分,我确信情况并非如此。 For example, the session stickiness is configured in JBoss nodes in mod_cluster subsystems - worker ndoes report this to the Apache HTTP Server balancer. 例如,会话粘性在mod_cluster子系统中的JBoss节点中配置 - 工作者ndoes将此报告给Apache HTTP Server平衡器。

HTH, -K- HTH,-K-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM