Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker install zookeeper3.4

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

1. Configure the mapping of hostname to ip

Vi etc/hosts

2. Modify ZooKeeper configuration file

Modify the ZooKeeper configuration file. On the master machine, use the tar-zxvf command to extract the zookeeper-3.4.10.tar.gz.

Tar-zxvf / zookeeper-3.4.10.tar.gz-C / usr/local/

Cd / usr/local

Mv zookeeper-3.4.10 zookeeper

3. Configuration file conf/zoo.cfg

Profile conf/zoo.cfg

Use the cd command to enter the zookeeper-3.4.10/conf directory and copy the zoo_sample.cfg file

Beiyi, named "zoo.cfg".

Cp zoo_sample.cfg zoo.cfg

Zoo.cfg file configuration

TickTime=2000

InitLimit=10

SyncLimit=5

DataDir=/usr/local/zookeeper/zookeeper/zkdata

ClientPort=2181

DataLogDir=/usr/local/zookeeper/zookeeper/zkdatalog

Server.1=master:2888:3888

Server.2=slave1:2888:3888

Server.3=slave2:2888:3888

4. Create two folders, zkdata and zkdatalog

In the directory of zookeeper, create two folders, zkdata and zkdatalog.

The zkdatalog folder is to specify the corresponding path for zookeeper to generate logs.

Mkdir zkdata

Mkdir zkdatalog

5. Modify myid

Go to the zkdata folder, create the file myid, and write 1

6. Copy and distribute installation files remotely

Copy and distribute installation files remotely

The ZooKeeper has been configured on a machine master above, and you can now configure the

The installation files are remotely copied to the corresponding directory of each node in the cluster:

Scp-r / usr/local/zookeeper root@slave1:/usr/local

Scp-r / usr/loca/zookeeper root@slave2:/usr/local

7. Set myid from the node

Set up the myid. Create a myid under the directory specified by the dataDir that we configured

File, which contains a number that identifies the current host, which is configured in the conf/zoo.cfg file

Why is the number X in server.X, then this number is entered in the myid file.

Myid in Slave1 is 2

Myid in Slave2 is 3

8. Configure environment variables and start ZooKeeper

Configure environment variables and start ZooKeeper. On each machine, do the following:

Vi / etc/profile

# set zookeeper environment

Export ZOOKEEPER_HOME=/usr/local/zookeeper/

PATH=$PATH:$ZOOKEEPER_HOME/bin

Take effect

Source / etc/profile

9. Start the ZooKeeper cluster

Start the ZooKeeper cluster

On each node of the ZooKeeper cluster, execute the script to start the ZooKeeper service, as follows

Show:

Bin/zkServer.sh start

Bin/zkServer.sh status

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report