table of Contents
Two, stand-alone installation of zookeeper
Three, commonly used zk commands
Fourth, use ZooInspector to view zookeeper
Seven, the characteristics of distributed zk
1. Why do we need zookeeper
The distributed coordination manager is used to elect the master node in the environment of entering the group. When the master node is down, other nameNodes will be elected as the master node to ensure the high availability of the cluster.
Two, stand-alone installation of zookeeper
Three, commonly used zk commands
ls View node list
create /app1 “some_data” Create node
set /app1 "other_data" set the value of the node
get /app1 Get the value of the node
delete /app1 delete node
Fourth, use ZooInspector to view zookeeper
Download https://issues.apache.org/jira/secure/attachment/12436620/ZooInspector.zi
After downloading, it is a compressed file. After decompressing, you will get a jar package and double click to open
Enter the ip of zk: port, connection timeout information, etc.
After the connection is successful, double-click the folder to expand to see the list of zk nodes
Five, zk data model
The default maximum of each node of zk is 1M, and an error will be reported if it exceeds 1M.
Six, install distributed zk
Seven, the characteristics of distributed zk
The zk cluster will automatically elect a node as the leader and other nodes as followers to form a cluster to provide services to the outside world.
No matter which node is connected to view the data, the data is the same, indicating that the data between each node is synchronized.
If the transaction related operation is performed on the slave node, it will be executed on the leader node that is forwarded first, such as creating a node, etc.
A client can connect to multiple nodes in the cluster at the same time, which can ensure that if one of the nodes goes down, it can continue to obtain data from other nodes.