Operations 5 min read

Deploying Zookeeper and ActiveMQ Cluster on Three Servers

This guide walks through setting up a three‑node Zookeeper ensemble, configuring ActiveMQ with replicated LevelDB storage, and starting the services on each host, providing full command‑line steps, configuration snippets, and verification screenshots for a production‑grade deployment.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Deploying Zookeeper and ActiveMQ Cluster on Three Servers

This article describes how to deploy a Zookeeper ensemble and an ActiveMQ cluster across three servers (192.168.20.40, 192.168.20.43, 192.168.20.39) and start the services.

Restart Zookeeper on each server

cd /data/zookeeper/bin/

ls

./zkServer.sh start

Output shows "ZooKeeper JMX enabled by default", the config file used, and "Starting zookeeper ... STARTED" for each node.

Install and configure ActiveMQ on the master node

tar -zxvf apache-activemq-5.15.14-bin.tar.gz

mv apache-activemq-5.15.14 /data/activemq

cd /data/activemq/conf/

vim activemq.xml

In activemq.xml replace the default persistence adapter with a replicated LevelDB configuration:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="cluster-mq" dataDirectory="${activemq.data}">
  <!--
  <persistenceAdapter>
    <kahaDB directory="${activemq.data}/kahadb"/>
  </persistenceAdapter>
  -->
  <persistenceAdapter>
    <replicatedLevelDB
      directory="${activemq.data}/leveldb"
      replicas="3"
      bind="tcp://0.0.0.0:0"
      zkAddress="192.168.20.40:2181,192.168.20.43:2181,192.168.20.39:2181"
      zkPassword=""
      hostname="192.168.20.40"
sync="local_disk"
      zkPath="/activemq/leveldb-stores"/>
  </persistenceAdapter>
  <transportConnector name="openwire" uri="tcp://192.168.20.40:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</broker>

After saving the file, start ActiveMQ:

/data/activemq/bin/activemq start

The console logs show loading of environment, Java path, PID creation, and successful startup.

Result

The Zookeeper ensemble provides leader election, so only one node acts as the master while the other two remain in standby mode. Consequently, only the master node exposes the ActiveMQ ports (61616 and 8161); the standby nodes have those ports closed.

All steps are verified with screenshots (omitted here) and the deployment is considered complete.

operationsdevopsZookeeperLinuxCluster DeploymentActiveMQ
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.