2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
lataa linkki:Apache ZooKeeper
Lataamani versio: zookeeper-3.4.12
Pura latauksen jälkeen
1. Luo "data"-kansio ja "loki"-kansio D:zookeeper-3.4.12-kansioon
2. Kopioi zoo_sample.cfg ja nimeä uudelleen: zoo.cfg
Muokkaa zoo.cfg-tiedostoa
- # 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
Syötä hakemisto: D:zookeeper-3.4.12bin
1. Suorita zkServer.cmd
2. Suorita zkCli.cmd
- #连接本地zk
- zkCli.cmd
-
- #链接远程zk
- zkCli.cmd -server ip:port
Käytä osoitteessa zkCli.cmd
1. Luo solmuja
create /test "my_data"
Solmu:/testi
Arvo: my_data
Huomautus: Kun luot solmun zk:ssä, sen täytyy alkaa kirjaimella "/", muuten raportoidaan virhe:Komento epäonnistui: java.lang.IllegalArgumentException: Polun alussa on oltava / merkki
2. Hanki solmut
get /test
3. Muokkaa solmuja
set /test "abc"
4. Luo lapsisolmuja
create /test/child "child"
5. Näytä lapsisolmut
ls /test
6. Poista solmu
delete /test/child