简体   繁体   English

我应该何时在ActiveMQ中使用JDBC持久性适配器?

[英]When should I use the JDBC Persistence Adapter in ActiveMQ?

Reading the ActiveMQ documentation (we are using the 5.3 release), I find a section about the possibility of using a JDBC persistence adapter with ActiveMQ. 阅读ActiveMQ文档(我们使用的是5.3版本),我找到了一个关于在ActiveMQ中使用JDBC持久性适配器的可能性的部分。

What are the benefits? 有什么好处? Does it provide any gain in performance or reliability? 它是否提供了性能或可靠性的任何增益? When should I use it? 我应该什么时候使用它?

In my opinion, you would use JDBC persistence if you wanted to have a failover broker and you could not use the file system. 在我看来,如果你想拥有一个故障转移代理并且你无法使用文件系统,那么你将使用JDBC持久性。 The JDBC persistence was significantly slower (during our tests) than journaling to the file system. JDBC持久性(在我们的测试期间)明显慢于对文件系统的日志记录。 For a single broker, the journaled file system is best. 对于单个代理,日志文件系统是最好的。

If you are running two brokers in an active/passive failover, the two brokers must have access to the same journal / data store so that the passive broker can detect and take over if the primary fails. 如果在主动/被动故障转移中运行两个代理,则两个代理必须能够访问同一个日志/数据存储,以便被动代理可以检测并接管主节点故障。 If you are using the journaled file system, then the files must be on a shared network drive of some sort, using NFS, WinShare, iSCSI, etc. This usually requires a higher-end NAS device if you want to eliminate the file share as a single point of failure. 如果您使用的是日志文件系统,那么这些文件必须位于某种共享网络驱动器上,使用NFS,WinShare,iSCSI等。如果您想要消除文件共享,通常需要更高端的NAS设备。单点故障。

The other option is that you can point both brokers to the database, which most applications already have access to. 另一个选择是您可以将两个代理指向数据库,大多数应用程序已经可以访问该数据库。 The tradeoff is usually simplicity at the price of performance, as the journaled JDBC persistence was slower in our tests. 由于在我们的测试中记录的JDBC持久性较慢,因此权衡通常是以性能为代价的简单性。

We run ActiveMQ in an active/passive broker pair with journaled persistence via an NFS mount to a dedicated NAS device, and it works very well for us. 我们在主动/被动代理对中运行ActiveMQ,并通过NFS挂载到专用NAS设备进行日志持久化,它对我们非常有效。 We are able to process over 600 msgs/sec through our system with no issues. 我们能够通过我们的系统处理超过600 msgs / sec,没有任何问题。

Hey, the use of journaled JDBC seems to be better than using JDBC persistence only since the journaling is very much faster than JDBC persistence. 嘿,使用日志JDBC似乎比使用JDBC持久性更好,因为日志记录比JDBC持久性快得多。 It is better than just journalled persistence only cos' you have an additional backup of the messages in the db. 它比仅仅记录持久性更好cos'你在db中有一个额外的消息备份。 Journalled JDBC has the additional advantage that the same data in journal is persisted to the db later and this can be accessed by developers when needed! Journalled JDBC具有额外的优势,即日志中的相同数据将在以后持久保存到db,开发人员可以在需要时访问它!

However, when you are using master/slave ActiveMQ topology with journalled JDBC, you might end up loosing messages since you might have messages in journal that are not yet into the DB! 但是,当您使用带有记录的JDBC的主/从ActiveMQ拓扑时,您可能最终会丢失消息,因为您可能在日志中还有尚未进入数据库的消息!

If you have a redelivery plugin policy in place and use a master/slave setup, the scheduler is used for the redelivery. 如果您具有重新传递插件策略并使用主/从设置,则调度程序将用于重新传递。

As of today, the scheduler can only be setup on a file database, not on the JDBC. 截至今天,调度程序只能在文件数据库上设置,而不能在JDBC上设置。 If you do not pay attention to that, you will take all messages that are in redelivery out of the HA scenario and local to the broker. 如果您不注意这一点,您将把所有正在重新发送的消息从HA场景中取出并放在代理本地。

https://issues.apache.org/jira/browse/AMQ-5238 is an issue in Apache issue tracker that asks for a JDBC persistence adapter for schedulerdb. https://issues.apache.org/jira/browse/AMQ-5238是Apache问题跟踪器中的一个问题,它要求为schedulerdb提供JDBC持久性适配器。 You can place a vote for it to make it happen. 您可以对其进行投票以实现它。

Actually, even on the top AMQ HA solution, LevelDB+ZooKeeper, the scheduler is taken out of the game and documented to create issues ( http://activemq.apache.org/replicated-leveldb-store.html at end of page). 实际上,即使在最顶级的AMQ HA解决方案LevelDB + ZooKeeper上,调度程序也会从游戏中删除并记录下来以创建问题( http://activemq.apache.org/replicated-leveldb-store.html在页面末尾) 。

In a JDBC scenario, therefor it can be considered unsafe and unsupported, but at least not clearly documented, how to setup the datastore for the redelivery policy. 在JDBC方案中,因此可以将其视为不安全且不受支持,但至少没有明确记录,如何为重新传递策略设置数据存储。

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

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