기술나눔

Windows에 Zookeeper 설치

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

설치하다

다운로드 링크:아파치 주키퍼

내가 다운로드한 버전: Zookeeper-3.4.12

다운로드 후 압축을 풀어주세요

구성

1. D:zookeeper-3.4.12 폴더에 "data" 폴더와 "log" 폴더를 생성합니다.

2. Zoo_sample.cfg를 복사하고 이름을 Zoo.cfg로 바꿉니다.

Zoo.cfg 파일 수정

  1. # The number of milliseconds of each tick
  2. tickTime=2000
  3. # The number of ticks that the initial
  4. # synchronization phase can take
  5. initLimit=10
  6. # The number of ticks that can pass between
  7. # sending a request and getting an acknowledgement
  8. syncLimit=5
  9. # the directory where the snapshot is stored.
  10. # do not use /tmp for storage, /tmp here is just
  11. # example sakes.
  12. #dataDir=/tmp/zookeeper
  13. dataDir=D:zookeeper-3.4.12data
  14. dataLogDir=D:zookeeper-3.4.12log
  15. # the port at which the clients will connect
  16. clientPort=2181
시작하다

디렉터리를 입력하세요: D:zookeeper-3.4.12bin

1. zkServer.cmd 실행

2. zkCli.cmd 실행

  1. #连接本地zk
  2. zkCli.cmd
  3. #链接远程zk
  4. zkCli.cmd -server ip:port
간단한 사용법

zkCli.cmd에서 작동

1. 노드 생성

 create /test "my_data"

노드:/테스트

값: my_data

참고: zk에서 노드를 생성할 때 "/"로 시작해야 합니다. 그렇지 않으면 오류가 보고됩니다.명령이 실패했습니다: java.lang.IllegalArgumentException: 경로는 / 문자로 시작해야 합니다.

2. 노드 가져오기

get /test

3. 노드 수정

 set /test "abc"

4. 자식 노드 생성

create /test/child "child"

5. 하위 노드 보기

ls /test

6. 노드 삭제

delete /test/child