Apache、Tomcat:负载平衡不起作用,无法与 Tomcat 连接

Apache、Tomcat:负载平衡不起作用,无法与 Tomcat 连接

我正在对 2 个服务器进行负载平衡。两者都在不同的域名上。我已经为他们配置了负载平衡。目前,我无法建立连接。我究竟做错了什么?另外,我需要在 server2 上进行什么配置才能使其工作?

错误日志:

Connection refused: AH00957: HTTP: attempt to connect to IP:8090 (IP) failed

Apache 000-default.conf :

<VirtualHost *:443>
ServerName domain.de
ServerAlias www.domain.de
SSLEngine on
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
SSLCertificateFile /etc/letsencrypt/live/domain.de/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.de/private.key
SSLCertificateChainFile /etc/letsencrypt/live/domain.de/chain.pem
<Proxy balancer://mycluster>
       BalancerMember http://IP:8090 route=server1
       BalancerMember http://IP:8009 route=server2
</Proxy>
 ProxyPass /balancer-manager !
 ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://cluster/
ProxyPreserveHost On
</VirtualHost>

雄猫:

<Connector port="8443" enableLookups="true" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" 
maxThreads="200" disableUploadTimeout="true" connectionTimeout="36000"
compression="off" sslProtocols="TLS" sslEnabledProtocols="TLSv1.2,TLSv1.1,TLSv1" ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_
ECDHE_RSA_WITH_AES_256_CBC_SHA384,
 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA256,
TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA,SSL_RSA_WITH_RC4_128_SHA"
 compressionMinSize="1024" scheme="https" secure="true" clientAuth="false" 
keystoreFile="/etc/letsencrypt/live/domain.de/KEYSTORE.jks" keyPass="PASS" keyAlias="tomcat" keystorePass="PASS" URIEncoding="utf-8"/>

    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <Engine name="Catalina" defaultHost="localhost" jvmRoute="server1">

答案1

您的 HTTPS 连接器在端口 8443 上运行,AJP 在 8009 上运行,而不是在 8090 上运行。

编辑:

<Proxy balancer://mycluster>
       BalancerMember ajp://SERVER1_IP:8009 route=server1
       BalancerMember ajp://SERVER2_IP:8009 route=server2
</Proxy>
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/

# I think you can remove these lines
#ProxyPassReverse / balancer://mycluster/
#ProxyPreserveHost On

相关内容