如何通过 mod_jk 将请求强制发送给特定的工作人员?
如果我设置了多个工作线程和一个负载均衡器工作线程的 mod_jk,是否有一个请求参数或其他参数可以让我将特定的 http 请求强制发送给特定的工作线程。 例如,如果我有一个工人worker1,是否有类似这样的内容:
http://www.example.com? worker=worker1
通常,我们需要解决集群中特定服务器上的问题,并且能够将请求直接强制到该服务器是至关重要的。
If I have mod_jk set up with several workers and a load balancer worker, is there a request parameter or something that would allow me to force a specific http request down to a specific worker. For instance if I have a worker worker1 is there something like this:
http://www.example.com?worker=worker1
Often we need to troubleshoot problems on a specific server in the cluster and being able to force the request directly to that server is essential.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为常见的做法是通过主域的别名子域来做到这一点。 只需确保您不让 Google 编制索引,因为您会遇到重复内容问题。 IP 过滤和限制性 robots.txt 可以完成这项工作。
I think the common practice is to do that via subdomains which alias the main domain. Just make sure that you don't let Google index because you'll have duplicate content issues. IP filtering and a restrictive robots.txt will do the job.
调整 JSESSIONID cookie 的值。 末尾有您所粘连的工作人员的名称(假设您正在进行粘性会话)
按照此处所述使用 SetHandler http://tomcat.apache.org/connectors-doc/reference/apache.html 而不是 JKMount 指令
类似这样的事情:
<前><代码>
<位置>>
SetHandler jakarta-servlet
SetEnvIf REQUEST_URI ^/.*\?.*worker=(\w+)&?$ JK_WORKER_NAME=$1
Tweak the value of your JSESSIONID cookie. The end has the name of the worker you're stuck to (assuming you're doing sticky sessions)
Use SetHandler as described here http://tomcat.apache.org/connectors-doc/reference/apache.html instead of JKMount directives
Something like this: