简体   繁体   English

多个Apache mod_jk服务器指向同一个Tomcat工作者?

[英]Multiple Apache mod_jk servers pointing to the same Tomcat worker?

We have a single Tomcat app server and a single front-end web server running Apache and mod_jk. 我们有一个Tomcat应用服务器和一个运行Apache和mod_jk的前端Web服务器。 Is it possible for us to add a second front-end web server, that points to the same app server and also runs Apache and mod_jk? 我们是否可以添加第二个前端Web服务器,它指向同一个应用服务器并运行Apache和mod_jk?

We don't want to do this for reasons of load balancing. 出于负载平衡的原因,我们不希望这样做。 Rather, it's for reasons of migration. 相反,这是出于迁移的原因。 The new web server will be an entirely different OS and will use a different SSO authentication module. 新的Web服务器将是一个完全不同的操作系统,将使用不同的SSO身份验证模块。 We want to be able to stage and test it, switch a DNS entry to make it live, and decommission the old server. 我们希望能够进行分级和测试,切换DNS条目以使其生效,并停用旧服务器。

The current workers.properties file looks like this: 当前的workers.properties文件如下所示:

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=10.x.x.x
worker.worker1.port=8009

Can I just duplicate that config onto a second web server? 我可以将该配置复制到第二个Web服务器上吗?

I have no experience or background whatsoever with any of this, but have been asked to assist with a server migration and am trying my best to help. 我没有任何经验或任何背景,但已被要求协助服务器迁移,我正尽力帮助。

I have been reading the documentation for mod_jk and Tomcat. 我一直在阅读mod_jk和Tomcat的文档。 I have found all sorts of documentation on pointing a single mod_jk instance to multiple Tomcat app servers, but nothing describing the opposite of that, which is what I'm trying to accomplish? 我找到了将单个mod_jk实例指向多个Tomcat应用服务器的各种文档,但没有描述相反的内容,这正是我想要完成的事情?

Is this possible? 这可能吗?

Edit: I should note that we do not have any access to the Tomcat server, as it is managed by a third-party vendor. 编辑:我应该注意,我们没有任何访问Tomcat服务器的权限,因为它由第三方供应商管理。 I'm sure they'd make changes if we asked them, but we don't have the ability to log into it ourselves. 如果我们问他们,我相信他们会做出改变,但我们没有能力自己登录。

Yes, of course you can. 是的,当然可以。 I have done it several times, even just to change the static files served by Apache (js, images, css) and test the Tomcat application with a different "skin". 我已经做了好几次,甚至只是为了更改Apache(js,images,css)提供的静态文件,并使用不同的“皮肤”测试Tomcat应用程序。

Usually when building a high availability system, not only the Tomcat's or any other back-end servers get replicated, the front-end Apache or IIS or whatever is used gets replicated too. 通常在构建高可用性系统时,不仅会复制Tomcat或任何其他后端服务器,前端Apache或IIS或其他任何使用的服务器也会被复制。

As you said, it should be fine just copying the workers.properties file and the mapping rules in the Apache httpd's *.conf files. 正如您所说,只需复制workers httpd的* .conf文件中的workers.properties文件和映射规则即可。

An also, check with tomcat management team that the incoming connections to Tomcat's AJP port are not limited by net rules or firewalls, making just the old Apache able to reach the Tomcat. 另外,请与tomcat管理团队核实,与Tomcat的AJP端口的传入连接不受网络规则或防火墙的限制,只使旧的Apache能够访问Tomcat。

Yes - duplicating will be easiest. 是的 - 复制将是最简单的。 Most important** is keeping the worker name the same. 最重要的**是保持工人姓名相同。

One gotcha is making sure Tomcat has enough connections available to be handled by both web servers. 一个问题是确保Tomcat有足够的连接可供两个Web服务器处理。 The normal defaults are typically high enough, but if you try to stress test, the tomcat server may need the sum of workers available on the webservers. 正常默认值通常足够高,但如果您尝试进行压力测试,则tomcat服务器可能需要Web服务器上可用的工作者总数。 But if you don't have enough, Tomcat does write a warning to the logs. 但是如果你没有足够的,Tomcat会给日志写一个警告。

** Most important - Ok - Not that important since you are not using sticky sessions. **最重要 - 好 - 由于您没有使用粘性会话,因此并不重要。 But could be confusing later if you try this experiment with 2 tomcats when switching between web servers. 但是,如果您在Web服务器之间切换时尝试使用2个tomcats进行此实验,可能会让人感到困惑。

Can I just duplicate that config onto a second web server? 我可以将该配置复制到第二个Web服务器上吗?

Yes sure, since you want to hit the same Tomcat server so you can simply copy your worker.properties from Apache instance 1 to Apache instance 2. If you have only those 4 properties then nothing but if you have some properties like worker.worker1.cachesize=10 or worker.worker1.cache_timeout=600 and you want to play around then change it. 是的,因为您想要访问相同的Tomcat服务器,因此您只需将您的worker.properties从Apache实例1复制到Apache实例2.如果您只有这4个属性,那么除了您有一些属性,如worker.worker1.cachesize=10worker.worker1.cache_timeout=600 ,你想玩,然后改变它。 But bottom line is that since you want to hit same Tomcat instance so you can simply copy. 最重要的是,因为你想要击中相同的Tomcat实例,所以你可以简单地复制。

Understanding it in non-tomcat way - you can have more than 1 HTTP web server like Apache intercepting all the requests and then forwarding it to same application or web server. 以非tomcat方式理解它 - 您可以拥有多个HTTP Web服务器,如Apache拦截所有请求,然后将其转发到同一个应用程序或Web服务器。 However this is not common because common thing is a web server load balancing the requests for back end application servers. 然而,这并不常见,因为常见的事情是Web服务器负载平衡后端应用程序服务器的请求。

I have been reading the documentation for mod_jk and Tomcat. 我一直在阅读mod_jk和Tomcat的文档。 I have found all sorts of documentation on pointing a single mod_jk instance to multiple Tomcat app servers, but nothing describing the opposite of that, which is what I'm trying to accomplish? 我找到了将单个mod_jk实例指向多个Tomcat应用服务器的各种文档,但没有描述相反的内容,这正是我想要完成的事情?

Is this possible? 这可能吗?

You couldn't find in any of the reading because what you are trying is a corner case, generally people configure multiple Tomcat workers to serve servlets on behalf of a certain web server in order to achieve load balancing, virtual hosting etc. 您无法找到任何读数,因为您正在尝试的是一个极端情况,通常人们配置多个Tomcat工作人员代表某个Web服务器提供servlet,以实现负载平衡,虚拟主机等。

You mentioned that you are doing all this in order to test the Apache running on different OS and using different SSO, I am assuming there is no hardware load balancer sitting in front of your web servers (Apache) so how you are gonna hit your new Apache? 你提到你正在做这一切,以测试运行在不同操作系统上的Apache并使用不同的SSO,我假设你的网络服务器(Apache)前面没有硬件负载均衡器,所以你将如何打击你的新Apache的? I think you need to do this explicitly because your current URL will be pointing your first Apache, so in order to hit second/new Apache you need to give your testers/users the URL containing end point (IP:port) of second/new Apache. 我认为您需要明确地执行此操作,因为您当前的URL将指向您的第一个Apache,因此为了命中第二个/新的Apache,您需要为您的测试人员/用户提供包含第二个/新的端点(IP:端口)的URL Apache的。 Even if you are doing all this locally still you need to have your second Apache listening on different port, or may be different IP but that's not common. 即使您在本地执行所有这些操作仍然需要让您的第二个Apache在不同的端口上进行侦听,或者可能是不同的IP,但这并不常见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM