Windows environment actimvemq+zookeeper pseudo-cluster configuration

Activemq+zookeeper cluster configuration method
Zookeeper version: zookeeper-3.4.10
activemq version activemq--5.14.5

Install zookeeper
official website and download
zookpeer
. 2, zookeeper-3 three directories.
Take zookeeper1 as an example,
1. Copy the zoo_sample.cfg file in the conf directory under the zookeeper installation directory, name it zoo.cfg, and add the server number, IP, and port information at the end of the file. The three node configuration files are the same.
server.1=127.0.0.1:2887:3887
server.2=127.0.0.1:2888:3888 
server.3=127.0.0.1:2889:3889
Also configure the data and log file paths in the zoo.cfg file,
dataDir=D: \\zookeeper-1\\data
dataLogDir=D:\\zookeeper-1\\log

2. Create a new myid file in the zookeeper-1\data directory (no file suffix), the content in it is 1, corresponding to the server. serial number configuration 's serial number. Fill in 2 for the content of this file in the zookeeper-2 directory, and so on.

The second step is to install activemq, download activemq, decompress and install 3 copies in a directory of D drive, named apache-activemq-master, apache-activemq-slave1, apache-activemq-slave2,
take activemq-master as an example to configure activemq .xml file
1. Add persistenceAdapter node content
        <persistenceAdapter>
          <!--
            <kahaDB directory="${activemq.data}/kahadb"/>
            <jdbcPersistenceAdapter dataSource="#mysql-ds" useDatabaseLock="false"/>
            <kahaDB directory="D:\\ActiveMQ Cluster\\shareBrokerData" enableIndexWriteAsync="true" enableJournalDiskSyncs="false"/>-->
             <replicatedLevelDB
              directory="${activemq.data}/leveldb"
              replicas="3"
              bind="tcp://0.0.0.0:0"
              zkAddress="127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183"
              zkSessionTimeout="2s"
              sync="local_disk"
              zkPath="/activemq/leveldb-stores"/>
        </persistenceAdapter>

2. Configuration Port information, modify the content of the transportConnectors node, and the ports of other nodes do not conflict.

The third step is to start the test, you need to start 3 zookeepers first, then start 3 activemq, stop one of the activemq instances, it will automatically switch to the normal activemq instance Above, only one activemq takes effect at the same time





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326370599&siteId=291194637