There is a data model inside zookeeper, which is a hierarchical namespace; the namespace is similar to an ordinary file system, which is mainly used to store configuration information; the namespace has a root path “/”, There are also hierarchical nodes znode, each level node has data.
1. Shell operation zookeeper
1. Enter zookeeper operation command line: ./zkCli.sh
2, view: ls /
3. Create node zk, data For mydata: create /zk mydata, after creating it, use ls / to see more zk
4. Get data: get /zk, you can see that the data is mydata
5. Modify data: set /zk hello, after modification, use get /zk to See the data changed to hello
< /p>
6. Delete node: delete /zk, after deleting, use ls / find that zk is gone
Second, java operation zookeeper
http://www.voidcn.com/article/p-bqkmofqb-pz.html