2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
download link:Apache ZooKeeper
The version I downloaded: zookeeper-3.4.12
After downloading, unzip
1. Create a "data" folder and a "log" folder in the D:zookeeper-3.4.12 folder
2. Copy zoo_sample.cfg and rename it to zoo.cfg
Modify the zoo.cfg file
- # The number of milliseconds of each tick
- tickTime=2000
- # 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=/tmp/zookeeper
- dataDir=D:zookeeper-3.4.12data
- dataLogDir=D:zookeeper-3.4.12log
- # the port at which the clients will connect
- clientPort=2181
Enter the directory: D:zookeeper-3.4.12bin
1. Execute zkServer.cmd
2. Execute zkCli.cmd
- #连接本地zk
- zkCli.cmd
-
- #链接远程zk
- zkCli.cmd -server ip:port
Operation on zkCli.cmd
1. Create a node
create /test "my_data"
Node: /test
Value: my_data
Note: When creating a node in zk, it must start with "/", otherwise an error will be reported:Command failed: java.lang.IllegalArgumentException: Path must start with / character
2. Get the node
get /test
3. Modify the node
set /test "abc"
4. Create child nodes
create /test/child "child"
5. View child nodes
ls /test
6. Delete a node
delete /test/child