Hi we use the master-slave cluster,using Apache ZooKeeper to pick a master,
we have three replications(192.168.1.98,99,116),we have one master ,two
slaves,and three zookeepers(192.168.103,104,105) ,one of the configurations of
replications is as follows:
<persistenceAdapter>
<replicatedLevelDB
directory="${activemq.data}"
replicas="3"
bind="tcp://192.168.1.98:20099" <!-- the other two are
192.168.1.99:20099 and 192.168.1.116:20099 -->
zkAddress="192.168.1.103:2181,192.168.1.104:2181,192.168.1.105:2181"
zkPassword=""
zkPath="/activemq/leveldb-stores/z1"
hostname="192.168.1.98" <!-- the other two are
192.168.1.99and 192.168.1.116 -->
/>
</persistenceAdapter>
we do not need persistence,we only use the topic ,so our message is not
stored,as we running the master-slave cluster,it often elects automatically
,the pressure of master replication and the three zookeepers is not big,we
check the logfile $activemqdir/data/activemq.log ,we don't find any error or
exceptions,it tells us as follows:
2015-12-14 08:13:27,929 | INFO | Slave stopped |
org.apache.activemq.leveldb.replicated.MasterElector | ActiveMQ
BrokerService[replicating-broker] Task-2
2015-12-14 08:13:27,930 | INFO | Not enough cluster members have reported
their update positions yet. |
org.apache.activemq.leveldb.replicated.MasterElector | ActiveMQ
BrokerService[replicating-broker] Task-2
2015-12-14 08:13:27,958 | INFO | Promoted to master |
org.apache.activemq.leveldb.replicated.MasterElector | main-EventThread
2015-12-14 08:13:27,965 | INFO | Using the pure java LevelDB implementation. |
org.apache.activemq.leveldb.LevelDBClient | ActiveMQ
BrokerService[replicating-broker] Task-2
2015-12-14 08:14:46,837 | INFO | Master started: tcp://192.168.1.98:20099 |
org.apache.activemq.leveldb.replicated.MasterElector | ActiveMQ BrokerS
we can see that,it elected costs the time from 08:13:27,958 to 08:14:46,837,as
time goes on,the time elected will cost longer ,we must delete the dir
$activemqdir/data/ of all nodes after we can stop it,so it can elected quickly
after we start all the nodes,what's the matter with it ? why the cluster often
elected ,how it can elected quickly ?