gpt4 book ai didi

wildfly - 我无法让 session 复制与 Wildfly 10 一起使用

转载 作者:行者123 更新时间:2023-12-02 16:13:28 25 4
gpt4 key购买 nike

我们把httpd作为负载均衡器放在wildfly前面。我使用的是 Wildfly 10.1.0。

我有3台机器,一台主机,两台从机。

在我的master的domain.xml中,我有:

<subsystem xmlns="urn:jboss:domain:modcluster:2.0">
<mod-cluster-config proxies="mc-prox1" connector="ajp">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>

<socket-binding-groups>
<socket-binding-group name="full-ha-sockets" default-interface="public">
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="iiop" interface="unsecure" port="3528"/>
<socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>
<socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
<socket-binding name="jgroups-tcp" interface="private" port="7600"/>
<socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>
<socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
<socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>
<socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>

<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
<outbound-socket-binding name="mc-prox1">
<remote-destination host="192.168.2.201" port="8796"/>
</outbound-socket-binding>


</socket-binding-group>
</socket-binding-groups>

<server-groups>
<server-group name="mycluster" profile="full-ha">
<socket-binding-group ref="full-ha-sockets"/>
<deployments>
<deployment name="PATT_EAR.ear" runtime-name="PATT_EAR.ear"/>
</deployments>
</server-group>
</server-groups>

在我的从机 1 的hosts.xml 中,我有:

<servers>
<server name="server-web1" group="mycluster" auto-start="true">
<jvm name="jvm-web1">
<heap size="1024m" max-size="3072m"/>
<permgen size="1024m" max-size="1024m"/>
<jvm-options>
<option value="-server"/>
<option value="-d64"/>
</jvm-options>
</jvm>
</server>
</servers>

在我的从机 2 的 Hosts.xml 中,我有:

  <server name="server-web2" group="mycluster" auto-start="true">
<jvm name="jvm-web2">
<heap size="1024m" max-size="3072m"/>
<permgen size="1024m" max-size="1024m"/>
<jvm-options>
<option value="-server"/>
<option value="-d64"/>
</jvm-options>
</jvm>
</server>
</servers>

所有服务器都启动正常,在我的日志中:

主站的日志

2016-08-18 09:38:06,884 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0023: Starting server server-web1
2016-08-18 09:38:06,891 WARN [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1
2016-08-18 09:38:06,987 WARN [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1
2016-08-18 09:38:09,538 INFO [org.jboss.as.host.controller] (management task-4) WFLYHC0021: Server [Server:server-web1] connected using connection [Channel ID 622b12f8 (inbound) of Remoting connection 124392b0 to /192.168.2.201:42232 of endpoint "master:MANAGEMENT" <67c473e1>]
2016-08-18 09:38:09,633 INFO [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0023: Starting server server-web2
2016-08-18 09:38:09,634 WARN [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1
2016-08-18 09:38:09,685 INFO [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-web1
2016-08-18 09:38:09,753 WARN [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1
2016-08-18 09:38:16,741 INFO [org.jboss.as.domain.controller] (Host Controller Service Threads - 34) WFLYHC0019: Registered remote slave host "hostweb2", JBoss WildFly Full 10.1.0.CR1 (WildFly 2.2.0.CR9)
2016-08-18 09:38:19,254 INFO [org.jboss.as.domain.controller] (Host Controller Service Threads - 36) WFLYHC0019: Registered remote slave host "hostweb1", JBoss WildFly Full 10.1.0.CR1 (WildFly 2.2.0.CR9)
2016-08-18 09:38:20,150 INFO [org.jboss.as.host.controller] (management task-1) WFLYHC0021: Server [Server:server-web2] connected using connection [Channel ID 05201088 (inbound) of Remoting connection 0d2653a3 to /192.168.2.201:55390 of endpoint "master:MANAGEMENT" <67c473e1>]
2016-08-18 09:38:20,248 INFO [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-web2
2016-08-18 09:38:20,252 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://192.168.2.201:9990/management
2016-08-18 09:38:20,254 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://192.168.2.201:9990
2016-08-18 09:38:20,255 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.CR1 (WildFly Core 2.2.0.CR9) (Host Controller) started in 17840ms - Started 55 of 57 services (19 services are lazy, passive or on-demand)

从站的日志显示

2016-08-18 09:38:15,752 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) WFLYRMT0001: Listening on 192.168.2.202:9999
2016-08-18 09:38:19,273 INFO [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0148: Connected to master host controller at remote://192.168.2.201:9999
2016-08-18 09:38:19,364 INFO [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0023: Starting server server-web1
2016-08-18 09:38:19,366 WARN [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1
2016-08-18 09:38:19,474 WARN [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web1
2016-08-18 09:38:21,912 INFO [org.jboss.as.host.controller] (management task-10) WFLYHC0021: Server [Server:server-web1] connected using connection [Channel ID 45e867e4 (inbound) of Remoting connection 565bb1dc to /192.168.2.202:56530 of endpoint "hostweb1:MANAGEMENT" <60a9371d>]
2016-08-18 09:38:22,005 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.CR1 (WildFly Core 2.2.0.CR9) (Host Controller) started in 8419ms - Started 46 of 50 services (18 services are lazy, passive or on-demand)
2016-08-18 09:38:22,034 INFO [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-web1

还有

016-08-18 09:38:13,269 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) WFLYRMT0001: Listening on 192.168.2.203:9999
2016-08-18 09:38:16,763 INFO [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0148: Connected to master host controller at remote://192.168.2.201:9999
2016-08-18 09:38:16,847 INFO [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0023: Starting server server-web2
2016-08-18 09:38:16,850 WARN [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web2
2016-08-18 09:38:16,950 WARN [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0011: Ignoring <permgen> for jvm 'SUN' type jvm: jvm-web2
2016-08-18 09:38:19,968 INFO [org.jboss.as.host.controller] (management task-10) WFLYHC0021: Server [Server:server-web2] connected using connection [Channel ID 434a7830 (inbound) of Remoting connection 114a8665 to /192.168.2.203:60987 of endpoint "hostweb2:MANAGEMENT" <29b1c4e8>]
2016-08-18 09:38:20,052 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.CR1 (WildFly Core 2.2.0.CR9) (Host Controller) started in 8883ms - Started 46 of 50 services (18 services are lazy, passive or on-demand)
2016-08-18 09:38:20,083 INFO [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-web2

在httpd的配置文件中,我有:

##Creation du load balancer

CreateBalancers 1

<IfModule manager_module>
Listen PIXID-LBWEB:8796
ManagerBalancerName mycluster

<VirtualHost PIXID-LBWEB:8796>
KeepAliveTimeout 900
MaxKeepAliveRequests 0
AdvertiseFrequency 5
ServerAdvertise off
EnableMCPMReceive

<Location />
Order deny,allow
Deny from all
Allow from 192.168.2.202 192.168.2.203 192.168.2.204
</Location>

<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
Order deny,allow
Allow from all
</Location>

</VirtualHost>
</IfModule>

Listen 8080
ServerName PIXID-LBWEB:8080

NameVirtualHost PIXID-LBWEB:8080
<VirtualHost PIXID-LBWEB:8080>
ServerAdmin exploitation@abc.com
ServerName PIXID-LBWEB:8080

ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=off timeout=10
ProxyPassReverse / balancer://mycluster
ProxyPreserveHost On

ErrorLog "|/appli/apache2/bin/rotatelogs /log/apache/error_log_balancer.%Y-%m-%d 86400"
CustomLog "|/appli/apache2/bin/rotatelogs /log/apache/access_log_balancer.%Y-%m-%d 86400" common

<Location />
Order deny,allow
Allow from All
</Location>

</VirtualHost>

我遇到的问题是 session 不会在两台服务器之间复制。负载平衡工作没有问题。如果我停止从属服务器 1,我会切换到从属服务器 2,但 session 不存在,第二个服务器会为我创建一个新的 session ID。

我确实将 distributable 添加到了我的 web.xml 中。

我在配置中遗漏了什么吗?

感谢您的帮助。

最佳答案

问题在于

<socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
<socket-binding name="jgroups-tcp" interface="private" port="7600"/>
<socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>
<socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
<socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>

我必须删除interface="private"才能使其正常工作。

现在的新配置是

<socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.201}" multicast-port="45700"/>
<socket-binding name="jgroups-tcp" port="7600"/>
<socket-binding name="jgroups-tcp-fd" port="57600"/>
<socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.201}" multicast-port="45688"/>
<socket-binding name="jgroups-udp-fd" port="54200"/>

关于wildfly - 我无法让 session 复制与 Wildfly 10 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39016021/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com