0

我们在 Oracle DB 中使用所谓的JDBC 主从架构。我们有 2 个节点,每个节点都启动了一个代理。我们启动 Broker1(在 node1 上),它成为获取表锁定的 MASTER。然后我们在node2上启动Broker2,这个作为SLAVE启动。我们可以在 Slave broker 的日志中看到它每 10 秒尝试获取一次锁,但是失败了:

2013-06-12 19:32:38,714 | INFO  | Default failed to acquire lease.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.LeaseDatabaseLocker | main
2013-06-12 19:32:48,720 | INFO  | Default Lease held by Default till Wed Jun 12 19:32:57 UTC 2013 | org.apache.activemq.store.jdbc.LeaseDatabaseLocker | main

一切正常,然后在 SLAVE 的日志中我们看到它突然变成了 MASTER:

2013-06-13 00:38:11,262 | INFO  | Default Lease held by Default till Thu Jun 13 00:38:17 UTC 2013 | org.apache.activemq.store.jdbc.LeaseDatabaseLocker | main
2013-06-13 00:38:11,262 | INFO  | Default failed to acquire lease.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.LeaseDatabaseLocker | main
...
2013-06-13 00:38:21,314 | INFO  | Default, becoming the master on dataSource: org.apache.commons.dbcp.BasicDataSource@9c6a99d | org.apache.activemq.store.jdbc.LeaseDatabaseLocker | main
2013-06-13 00:38:21,576 | INFO  | Apache ActiveMQ 5.8.0 (Default, ID:corerec3-49774-1371083901328-0:1) is starting | org.apache.activemq.broker.BrokerService | main
2013-06-13 00:38:21,692 | WARN  | Failed to start jmx connector: Cannot bind to URL [rmi://localhost:1616/jmxrmi]: javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi]. Will restart management to re-create jmx connector, trying to remedy this issue. | org.apache.activemq.broker.jmx.ManagementContext | JMX connector
2013-06-13 00:38:21,700 | INFO  | Listening for connections at: tcp://corerec3:61617?transport.closeAsync=false | org.apache.activemq.transport.TransportServerThreadSupport | main
2013-06-13 00:38:21,700 | INFO  | Connector openwire Started | org.apache.activemq.broker.TransportConnector | main
2013-06-13 00:38:21,701 | INFO  | Apache ActiveMQ 5.8.0 (Default, ID:corerec3-49774-1371083901328-0:1) started | org.apache.activemq.broker.BrokerService | main
2013-06-13 00:38:21,701 | INFO  | For help or more information please see: http://activemq.apache.org | org.apache.activemq.broker.BrokerService | main
2013-06-13 00:38:21,701 | ERROR | Memory Usage for the Broker (512 mb) is more than the maximum available for the JVM: 245 mb | org.apache.activemq.broker.BrokerService | main
2013-06-13 00:38:22,157 | INFO  | Web console type: embedded | org.apache.activemq.web.WebConsoleStarter | main
2013-06-13 00:38:22,292 | INFO  | ActiveMQ WebConsole initialized. | org.apache.activemq.web.WebConsoleStarter | main
2013-06-13 00:38:22,353 | INFO  | Initializing Spring FrameworkServlet 'dispatcher' | /admin | main

而 MASTER 的日志显示与通常输出的内容没有任何变化......

因此,似乎 SLAVE 以某种方式获得了锁(由于嗯……例如 master 和 DB 之间的连接丢失),但是如果我们不重新启动代理,我们就会开始丢失消息……

问题是,在生产者的日志中,我们可以看到它成功地将消息发送到QueueX,但我们没有看到消费者从队列中取出它们......如果我们去数据库并查询我们看到的 _ACTIVEMQ_MSGS_ 表消息未处理。看起来好像代理(生产者连接到)有锁并将消息插入数据库,客户端正在消费的代理没有锁并且无法查询表......

我不知道这一切是否有道理,但我当然希望有人能对此有所了解......

我不想用配置详细信息使帖子饱和,但是如果您需要故障转移配置、IP、端口等特定详细信息。我会发布它...

4

0 回答 0