ActiveMQ 2 ActiveMQ ReplicationLevelDB这里只是简述我的配置以及碰到的问题.broker xmlnshttp://acti
ActiveMQ 2 ActiveMQ ReplicationLevelDB
这里只是简述我的配置以及碰到的问题.
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="broker"... <managementContext> <managementContext createConnector="true"/> </managementContext>...<persistenceAdapter> <!-- <kahaDB directory="${activemq.data}/kahadb"/> --> <!-- <jdbcPersistenceAdapter dataSource="#mysql-ds" /> --> <replicatedLevelDB directory="${activemq.data}/leveldb" replicas="3" bind="tcp://0.0.0.0:0" zkAddress="192.168.1.210:2181,192.168.1.211:2181,192.168.1.212:2181" zkPath="/activemq/leveldb-stores" hostname="192.168.1.210" sync="local_disk" /></persistenceAdapter>...</broker>
要求使用failover协议
引用failover:(tcp://192.168.1.210:61616,tcp://192.168.1.211:61616,tcp://192.168.1.212:61616)
问题一:
关闭ActiveMQ时异常
引用
Connecting to JMX URL: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
ERROR: java.lang.RuntimeException: Failed to execute stop task. Reason: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused]
将 <managementContext createConnector="true"/> 改为 true,默认是false.
问题二:
测试时使用了3个ActiveMQ集群Master-Slave, 比如我的是 210, 211, 212 , 如果正在使用 210为Master(测试方法为访问3台机器的 8161端口, 哪个可以访问,当前哪个是 Master),关闭 210 ,会在 MessageProducer.send 方法时阻塞, 无法正常工作,当210再次启动时, MessageProducer.send方法不再阻塞, 但 Master 可能会变成其他的node,比如 211.
解决办法是参照这里
http://blog.csdn.net/srnpr/article/details/17370813?reload
http://www.cnblogs.com/fuhaots2009/p/3478413.html
这两篇是一样的,不知道谁是原创,都粘贴了.
加上
sync="local_disk" 参数配置
引用
sync
default value: quorum_mem
Controls where updates are reside before being considered complete. This setting is a comma separated list of the following options: local_mem, local_disk, remote_mem, remote_disk, quorum_mem, quorum_disk. If you combine two settings for a target, the stronger guarantee is used. For example, configuring local_mem, local_disk is the same as just using local_disk. quorum_mem is the same as local_mem, remote_mem and quorum_disk is the same as local_disk, remote_disk
详细配置请参见: http://activemq.apache.org/replicated-leveldb-store.html