Original link: https://blog.51cto.com/4259679
Kafka cluster has been deployed before, zookeeper has been installed, please check past records
ip address host name install software
192.168.20.40 k8s-master zookeeper、ActiveMQ
192.168.20.43 k8s-node2 zookeeper、ActiveMQ
192.168.20.39 k8s-node3 zookeeper、ActiveMQ
Restart the zookeeper service on the three servers
[root@k8s-master ~]# cd /data/zookeeper/bin/
[root@k8s-master bin]# ls
README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer.cmd zkServer.sh zkServer.sh.back
[root@k8s-master bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /data/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@k8s-node2 ~]# cd /data/zookeeper/bin/
[root@k8s-node2 bin]# ls
README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer.cmd zkServer.sh
[root@k8s-node2 bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /data/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@k8s-node3 ~]# cd /data/zookeeper/bin/
[root@k8s-node3 bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /data/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root @ k8s-node3 bin] # ps -ef | grep zookeeper
Three servers install ActiveMQ
[root @ k8s-master ~] # tar -zxvf apache-activemq-5.15.14-bin.tar.gz
[root@k8s-master ~]# mv apache-activemq-5.15.14 /data/activemq
[root@k8s-master ~]# cd /data/activemq/conf/
[root@k8s-master conf]# vim activemq.xml
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="cluster-mq" dataDirectory="${activemq.data}">
Comment out here
<!--
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>
-->
Add configuration below
<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" is modified to the ip of each server
sync="local_disk"
zkPath="/activemq/leveldb-stores"/> Change to a different path
Modify the IP below
<transportConnector name="openwire" uri="tcp://192.168.20.40:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
Start ActiveMQ
[root@k8s-master conf]# /data/activemq/bin/activemq start
INFO: Loading '/data/activemq//bin/env'
INFO: Using java '/usr/local/java/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/data/activemq//data/activemq.pid' (pid '7865')
Deployment complete
Using zookeeper for load balancing, only one of the three servers will be the master, and the other two are in a waiting state, so only one of them provides services.
Therefore, although the active program of the other two servers is started, the service port 61616 and the management port 8161 are closed and waiting.
----------------------end---------------------
Recommended reading: