Chapter 5. Using the Replicated LevelDB Persistence Adapter
replicas="3"has a quorum size of
(3/2)+1=2. In this case, the master stores the update locally, then waits for at least one slave to store the update before it reports success.
- Clients should use the Failover Transport to connect to the broker nodes in the replication cluster; for example, using a URL like this:
- To enable highly available ZooKeeper service, run at least three ZooKeeper server nodes.NoteAvoid overcommitting ZooKeeper servers. An overworked ZooKeeper server might infer that a live broker replication node has gone offline due to delayed processing of keep-alive messages.For details on setting up and running a distributed cluster of Apache ZooKeeper servers, see the ZooKeeper Getting Started document.
- To enable highly available ActiveMQ service, run at least three replicated broker nodes.
replicatedLevelDBelement in the
persistenceAdapterelement of your broker's configuration, and use the
replicatedLevelDBelement's attributes to configure the message store.
Example 5.1. Configuring the Replicated LevelDB Message Store
<broker brokerName="broker" persistent="true" ... > ... <persistenceAdapter> <replicatedLevelDB directory="activemq-data" /> replicas="3" bind="tcp://0.0.0.0;0" zkAddress="zoo1.example.org:2181,zoo2.example.org:2181,zoo3.example.org:2181" zkPassword="password" zkPath="/activemq/leveldb-stores" /> </persistenceAdapter> ... </broker>
Table 5.1. Configuration Properties of the Replicated LevelDB Message Store—attributes which must be identical on all broker nodes in a replication cluster
zkSessionTimeoutto detect when it has been disconnected from the ZooKeeper server due to a network failure. When set to
2s, the replicated broker nodes will detect a disconnect within two seconds of a network failure. Once the disconnect is detected, the master broker gives up the master role, and the slave brokers begin the election process. The lower the timeout value, the faster the process to select a new master. However, setting the timeout value too low can result in false positives, causing masters to switch when no disconnect has occurred.
Table 5.2. Configuration Properties of the Replicated LevelDB Message Store—attributes which can be unique for each broker node in a replication cluster