Linux
Apache,Tomcat:負載平衡不起作用,無法與 Tomcat 連接
我正在對 2 台伺服器進行負載平衡。它們都在不同的域名上。我已經為他們配置了負載均衡。目前,我無法建立連接。我究竟做錯了什麼?另外,我需要在 server2 上進行什麼配置才能使其正常工作?
錯誤日誌:
Connection refused: AH00957: HTTP: attempt to connect to IP:8090 (IP) failed
阿帕奇 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">
您的 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