Cluster construction of Zookeeper

Reference documents:

https://my.oschina.net/u/3754001/blog/1802140
Installation and erection process is omitted here

I. network environment

Remarks:

Currently, it is a three node server, which allows one node to be damaged, the cluster state is normal, and normal services can be provided. For example, two nodes are damaged, only one node is left, and the entire zookeeper service is interrupted and cannot be connected.

2. View the status of the current server

[root@ops-site zookeeper]# ./bin/zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper/bin/../conf/zoo.cfg
Mode: follower         #The current status is folwer
[root@nbutest zookeeper]# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:50:56:AA:87:1A  
          inet addr:10.3.151.34  Bcast:10.3.151.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:feaa:871a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:296878910 errors:0 dropped:0 overruns:0 frame:0
          TX packets:101828532 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:113708004182 (105.8 GiB)  TX bytes:40542901999 (37.7 GiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:4575037 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4575037 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:442475408 (421.9 MiB)  TX bytes:442475408 (421.9 MiB)

[root@nbutest zookeeper]# ./bin/zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper/bin/../conf/zoo.cfg
Mode: leader         #Currently in leader status

3. Connect to the zookeeper server (any one can be connected in the cluster state)

[root@nbutest zookeeper]# ./bin/zkCli.sh -server 10.3.151.34:2181      #Connection method
Connecting to 10.3.151.34:2181

IV. create a znode node

[zk: 10.3.151.34:2181(CONNECTED) 0] create /mingkang test   
Created /mingkang        #A / mingkang znode node was created

V. view the current status of all nodes

[zk: 10.3.151.34:2181(CONNECTED) 1] ls /          #See all
[bb, cc, path, test, zookeeper, mingkang, bear, hehe, kang]

Keywords: Linux Zookeeper network

Added by rosieraz on Fri, 18 Oct 2019 18:00:05 +0300