如何通过负载平衡针对同一数据库运行多个tomcat
当多个tomcat访问同一个数据库时,请建议有哪些不同的方法可以实现数据库的负载平衡?
谢谢。
Please suggest what are different ways of achieving load balance on database while more than one tomcat is accessing the same database?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是详细的 使用多个 tomcat 实例和基于 apache 的负载平衡控制的示例
注意,如果您有一个可以进行负载平衡的硬件,那么它对我来说甚至是更好的方式(放置它而不是 apache)。
简而言之,它的工作原理如下:
关于数据库:
- tomcat 本身与您的数据库无关,它是与数据库通信的应用程序,而不是 Tomcat。
无论您的应用程序层如何,您都可以建立一个数据库服务器集群(例如,谷歌搜索 Oracle RAC,但它完全不同)。
一般来说,在实现应用程序层负载平衡时,请注意应用程序的常见状态会被复制。
称为“粘性会话”的技术可以部分解决该问题,但一般来说您应该意识到这一点。
希望这有帮助
This is a detailed example of using multiple tomcat instances and an apache based loadbalancing control
Note, if you have a hardware that would make a load balancing, its even more preferable way as to me (place it instead of apache).
In short it works like this:
Regarding the database :
- tomcat itself has nothing to do with your Database, its your application that talks to DB, not a Tomcat.
Regardless your application layer you can establish a cluster of database servers (For example google for Oracle RAC, but its entirely different story)
In general, when implementing application layer loadbalancing please notice that the common state of the application gets replicated.
The technique called "sticky session" partially handles the issue but in general you should be aware of it.
Hope this helps