minhas informações de contato
Correspondência[email protected]
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Link para Download:Apache ZooKeeper
A versão que baixei: zookeeper-3.4.12
Após baixar, descompacte
1. Crie uma pasta “data” e uma pasta “log” na pasta D:zookeeper-3.4.12
2. Copie zoo_sample.cfg e renomeie: zoo.cfg
Modifique o arquivo zoo.cfg
- # 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
Digite o diretório: D:zookeeper-3.4.12bin
1. Execute zkServer.cmd
2. Execute zkCli.cmd
- #连接本地zk
- zkCli.cmd
-
- #链接远程zk
- zkCli.cmd -server ip:port
Operar em zkCli.cmd
1. Crie nós
create /test "my_data"
Nó:/teste
Valor: meus_dados
Nota: Ao criar um nó em zk, ele deve começar com "/", caso contrário será relatado um erro:Falha no comando: java.lang.IllegalArgumentException: O caminho deve começar com o caractere /
2. Obtenha nós
get /test
3. Modifique os nós
set /test "abc"
4. Crie nós filhos
create /test/child "child"
5. Visualize nós filhos
ls /test
6. Excluir nó
delete /test/child