mod_jk hybris 负载均衡器
mod_jk hybris loadbalancer
我有两个 apache 2.4 网络服务器和 2 个 hybris 5.7.3 应用程序服务器。我决定在两个具有应用程序服务器负载平衡的 Web 服务器中配置 mod_jk 1.2.41。 Appservers 将 运行 only on https, 谁能帮我配置 mod_jk for hybris。
感谢@Benoit 的快速回复。这是配置:
httpd.conf 文件
LoadModule jk_module /usr/lib64/httpd/modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
<VirtualHost *>
ServerAlias www.thaitrade.dev
DocumentRoot /var/www
ServerName webserverurl
JkMount /* loadbalancer
JkMount /status/* status
</VirtualHost>
已更新 workers.properties 配置
# workers to contact, that's what you have in your httpd.conf
worker.list=loadbalancer,status
#setup node1
worker.worker1.port=8009
worker.worker1.host=hybrisserver1.ip
worker.worker1.type=ajp13
worker.worker1.lbfactor=50
#setup node2
worker.worker2.port=8009
worker.worker2.host=hybrisserver2.ip
worker.worker2.type=ajp13
worker.worker2.lbfactor=100
#setup the load-balancer
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=worker1,worker2
worker.loadbalancer.sticky_session=True
#worker.loadbalancer.sticky_session_force=True
# Status worker for managing load balancer
worker.status.type=status
并在 hybrisserver1
中将 jvmRoute 添加到 server.xml
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
在 hybrisserver2
中将 jvmRoute 添加到 server.xml
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker2">
我在 server.xml
添加了以下配置
<Connector protocol="AJP/1.3" port="8010" proxyPort="443" scheme="https" secure="true" />
创建了一个新的 ssl 虚拟主机配置
Listen 443 https
<VirtualHost *:443>
SSLEngine on
JkMountCopy On
SSLCertificateFile /etc/httpd/conf.d/certificate.crt
SSLCertificateKeyFile /etc/httpd/conf.d/certificate.key
</VirtualHost>
以下是 mod_jk 个错误
[Wed Apr 13 19:29:24 2016] [17689:140131769874496] [debug] jk_translate::mod_jk.c (3855): missing uri map for webservername:/hmc
[Wed Apr 13 19:29:24 2016] [17689:140131769874496] [debug] jk_map_to_storage::mod_jk.c (4023): missing uri map for webservername:/hmc
[Wed Apr 13 19:29:25 2016] [17826:140131769874496] [debug] jk_child_init::mod_jk.c (3474): Initialized mod_jk/1.2.41
[Wed Apr 13 19:29:27 2016] [17689:140131769874496] [debug] jk_translate::mod_jk.c (3855): missing uri map for webservername:/hac
[Wed Apr 13 19:29:27 2016] [17689:140131769874496] [debug] jk_map_to_storage::mod_jk.c (4023): missing uri map for webservername:/hac
这是我的配置。
我没有收到 ssl 证书。暂时我会生成自签名证书,你能指导我如何将 ssl 证书添加到 mod_jk 配置,我是否需要在 workers.properties 文件中添加新的工作人员和工作人员端口?
您好@BenoitVanalderweireldt,在 server.xml 中删除了代理端口并添加了 jvmRoute,还在 ssl 配置中添加了 x-forwarded-proto。就是这样,配置现在正在运行。感谢您的大力支持
我有两个 apache 2.4 网络服务器和 2 个 hybris 5.7.3 应用程序服务器。我决定在两个具有应用程序服务器负载平衡的 Web 服务器中配置 mod_jk 1.2.41。 Appservers 将 运行 only on https, 谁能帮我配置 mod_jk for hybris。
感谢@Benoit 的快速回复。这是配置:
httpd.conf 文件
LoadModule jk_module /usr/lib64/httpd/modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
<VirtualHost *>
ServerAlias www.thaitrade.dev
DocumentRoot /var/www
ServerName webserverurl
JkMount /* loadbalancer
JkMount /status/* status
</VirtualHost>
已更新 workers.properties 配置
# workers to contact, that's what you have in your httpd.conf
worker.list=loadbalancer,status
#setup node1
worker.worker1.port=8009
worker.worker1.host=hybrisserver1.ip
worker.worker1.type=ajp13
worker.worker1.lbfactor=50
#setup node2
worker.worker2.port=8009
worker.worker2.host=hybrisserver2.ip
worker.worker2.type=ajp13
worker.worker2.lbfactor=100
#setup the load-balancer
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=worker1,worker2
worker.loadbalancer.sticky_session=True
#worker.loadbalancer.sticky_session_force=True
# Status worker for managing load balancer
worker.status.type=status
并在 hybrisserver1
中将 jvmRoute 添加到 server.xml <Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
在 hybrisserver2
中将 jvmRoute 添加到 server.xml<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker2">
我在 server.xml
添加了以下配置 <Connector protocol="AJP/1.3" port="8010" proxyPort="443" scheme="https" secure="true" />
创建了一个新的 ssl 虚拟主机配置
Listen 443 https
<VirtualHost *:443>
SSLEngine on
JkMountCopy On
SSLCertificateFile /etc/httpd/conf.d/certificate.crt
SSLCertificateKeyFile /etc/httpd/conf.d/certificate.key
</VirtualHost>
以下是 mod_jk 个错误
[Wed Apr 13 19:29:24 2016] [17689:140131769874496] [debug] jk_translate::mod_jk.c (3855): missing uri map for webservername:/hmc
[Wed Apr 13 19:29:24 2016] [17689:140131769874496] [debug] jk_map_to_storage::mod_jk.c (4023): missing uri map for webservername:/hmc
[Wed Apr 13 19:29:25 2016] [17826:140131769874496] [debug] jk_child_init::mod_jk.c (3474): Initialized mod_jk/1.2.41
[Wed Apr 13 19:29:27 2016] [17689:140131769874496] [debug] jk_translate::mod_jk.c (3855): missing uri map for webservername:/hac
[Wed Apr 13 19:29:27 2016] [17689:140131769874496] [debug] jk_map_to_storage::mod_jk.c (4023): missing uri map for webservername:/hac
这是我的配置。 我没有收到 ssl 证书。暂时我会生成自签名证书,你能指导我如何将 ssl 证书添加到 mod_jk 配置,我是否需要在 workers.properties 文件中添加新的工作人员和工作人员端口?
您好@BenoitVanalderweireldt,在 server.xml 中删除了代理端口并添加了 jvmRoute,还在 ssl 配置中添加了 x-forwarded-proto。就是这样,配置现在正在运行。感谢您的大力支持