Mi informacion de contacto
Correo[email protected]
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
enlace de descarga:Apache ZooKeeper
La versión que descargué: zookeeper-3.4.12
Después de descargar, descomprimir
1. Cree una carpeta de "datos" y una carpeta de "registro" en la carpeta D:zookeeper-3.4.12
2. Copie zoo_sample.cfg y cambie el nombre: zoo.cfg
Modificar el archivo 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
Ingrese al directorio: D: zookeeper-3.4.12bin
1. Ejecute zkServer.cmd
2. Ejecute zkCli.cmd
- #连接本地zk
- zkCli.cmd
-
- #链接远程zk
- zkCli.cmd -server ip:port
Operar en zkCli.cmd
1. Crear nodos
create /test "my_data"
Nodo:/prueba
Valor: mis_datos
Nota: Al crear un nodo en zk, debe comenzar con "/", de lo contrario se informará un error:Error de comando: java.lang.IllegalArgumentException: La ruta debe comenzar con el carácter /
2. Obtener nodos
get /test
3. Modificar nodos
set /test "abc"
4. Crear nodos secundarios
create /test/child "child"
5. Ver nodos secundarios
ls /test
6. Eliminar nodo
delete /test/child