linux zookeeper, installation and configuration of zookeeper in linux

1.

1.1 Create four virtual machines and start:

bc9ec2affe2ae7dd240e181ccd1294e3.png

1.2 Create a centos7 folder in the shell and put four sessions in it, note1, note2, note3, note4

f4f55e8c5df0bb2096e2afc991bfe0ed.png

1.3 Successful establishment

1a1551dff630cbab80a4c64f207b31e2.png

2. Start configuration

2.1: Modify the hostname: hostnamectl set-hostname hostname --static (permanent)

Reboot: reboot

View hostname: hostname

f6ac630e962470fe45230e1c5f1078a0.png

2.2 Turn off the firewall

When entering service iptables stop, I get the following error:

4a4f03af395cee337cae0131785b6391.png

Then you need to install an iptables-service:

systemctl stop firewalld

systemctl mask firewalld

yum install iptables-services (installation)

systemctl stop iptables (turn on and off)

service iptables save(保存)

2.3: Set the sync button

71d2f158f56e2959c6fb6dc4462d694d.png

66c71b33131f5dfc0170d6321cb40ed3.png

2.4 Create the zookeeper folder

c0d1dd3099c4d335ba1df4729dcb535d.png

77fc643db37172b532ba8386695034f3.png

2.5 Click xftp6, open the zookeeper-bin file you want to transfer,

2.6 zookeeper download address:

https://mirrors.cloud.tencent.com/apache/zookeeper/zookeeper-3.5.7/

2.7note1,note2,note3, all use this method to upload

95a8c1479661ece6964f8072a5c0c63b.png

82b7824f18f7ec2a0b79e24833020d98.png

2.8 : 解压 : tar -zxvf apache-zookeeper-3.5.7-bin.tar.gz

9519adf111318d566cb6ad11993104e9.png

2.9 Rename:

mv apache-zookeeper-3.5.7-bin apache-zookeeper

cc74e9b866e89c90632fbaf09203e2b0.png

delete the tar package

082abd9e51ab0a964afb91747efd626a.png

Enter data, create and enter myid, modify the content inside

8710ca840cc044a546b5651e35259156.png

Write 0, 1, and 2 in myid respectively. i, modify; esc exit: wq! Force save and exit

b11b2b7897bffecb8d39b5ff886d7b54.png

Enter apache-zookeeper

332a96479449837434dc8af2dc7b6354.png

3. Modify the zookeeper configuration file:

3.1: Enter conf``[root@note1 apache-zookeeper]# cd conf/```

复制zoo_sample.cfg,给zoo.cfg。[root@note1 conf]# cp zoo_sample.cfg zoo.cfg

修改配置文件zoo.cfg 。 [root@note1 conf]# vim zoo.cfg

zoo.cfg配置文件:

dataDir=/data/zookeeper/data

server.0=note1:2888:3888

server.1=note2:2888:3888

server.2=note3:2888:3888

# The number of ticks that the initial

# synchronization phase can take

initLimit=10

# The number of ticks that can pass between

# sending a request and getting an acknowledgement

syncLimit=5

# the directory where the snapshot is stored.

# do not use /tmp for storage, /tmp here is just

# example sakes.

dataDir=/data/zookeeper/data

# the port at which the clients will connect

clientPort=2181

# the maximum number of client connections.

# increase this if you need to handle more clients

#maxClientCnxns=60

#

# Be sure to read the maintenance section of the

# administrator guide before turning on autopurge.

#

# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

#

# The number of snapshots to retain in dataDir

#autopurge.snapRetainCount=3

# Purge task interval in hours

# Set to "0" to disable auto purge feature

# autopurge.purgeInterval = 1

server.0=note1:2888:3888

server.1=note2:2888:3888

server.2=note3:2888:3888

3.2:启动zookeeper[root@note1 apache-zookeeper]# bin/zkServer.sh start

4489299f630636d897f7d1ac78370cdc.png

View status: [root@note1 apache-zookeeper]# bin/zkServer.sh status

jps start: jps

9ee0790e5d2c786c148581535356f401.png

3.3 Access note1:8080 on the browser (Firefox)

18f9ccc3eb7a922e33757fbcea86cf4b.png

3.4

f06f70c6b6af1979a0e786778be2f5b8.png

Complete the zookeeper configuration

3.4 :

View the log vim logs/zookeeper-root-server-note1.out

Distribution files: scp -r apache-zookeeper/root@note2$pwd scp -r apache-zookeeper/root@note3$pwd

Tags: cfg, note1, root, zookeeper, zoo, linux, apache, installation

Source: https://blog.csdn.net/XIAOMO__/article/details/104802404

Guess you like

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