목요일, 3월 23, 2023
Home Linux zookeeper JAVA API을 이용한 znode 생성,읽기,삭제 및 쓰기

zookeeper JAVA API을 이용한 znode 생성,읽기,삭제 및 쓰기

zookeeper JAVA API을 이용한 znode 생성,읽기,삭제 및 쓰기

바인딩

ZooKeeper 클라이언트 라이브러리는 자바와 C의 두 가지 언어로 제공됩니다.
다음 섹션에서는 JAVA 바인딩에 대해 설명합니다.

JAVA 바인딩

zookeeper Java 바인딩을 구성하는 패키지는 org.apache.zookeeper 와 org.apache.zookeeper.data 두 가지 입니다. 
zookeeper 를 구성하는 나머지 패키지는 내부적으로 사용되거나 서버 구현의 일부입니다. 
org.apache.zookeeper.data 패키지는 컨테이너로 간단하게 사용되는 생성 된 클래스로 구성되어 있습니다.

zookeeper Java 클라이언트가 사용하는 기본 클래스는 zookeeper 클래스입니다. 

zookeeper 앙상블을 연결하는 옵션을 제공하며 다음과 같은 방법이 있습니다.

  • connect − connect to the zookeeper host

  • create − create a znode

  • exists − check wahcher a znode exists and its information

  • getData − get data from a particular znode

  • setData − set data in a particular znode

  • getChildren − get all sub-nodes available in a particular znode

  • delete − get a particular znode and all its children

 

connect − connect to the zookeeper host
zookeeper 클래스는 생성자를 통해 연결 기능을 제공합니다. 생성자의 서명은 다음과 같습니다.

  • host : zookeeper server host
  • sessionTimeout:session timeout in milliseconds
  • watcher:a watcher object which will be notified of state changes, may also be notified for node events

프로그램 코드는 다음과 같습니다.

 

create − create a znode
create 메소드 의 서명은 다음과 같습니다.

  • path – the path for the node
  • data – the initial data for the node
  • acl – the acl for the node
  • createMode – specifying whether the node to be created is ephemeral and/or sequential

프로그램 코드는 다음과 같습니다.

 

exists − check wahcher a znode exists and its information

exists 메소드 의 서명은 다음과 같습니다.

  • path – the node path
  • watch – whether need to watch this node

프로그램 코드는 다음과 같습니다.

 

getData − get data from a particular znode

getData 메소드 의 서명은 다음과 같습니다.

  • path – the given path
  • watch – whether need to watch this node
  • stat – the stat of the node

프로그램 코드는 다음과 같습니다.

 

setData − set data in a particular znode

setData 메소드 의 서명은 다음과 같습니다.

  • path – the path of the node
  • data – the data to set
  • version – the expected matching version

프로그램 코드는 다음과 같습니다.

 

getChildren − get all sub-nodes available in a particular znode

getChildren 메소드 의 서명은 다음과 같습니다.

  • path – the given path
  • watch – whether need to watch this node

프로그램 코드는 다음과 같습니다.

 

delete − get a particular znode and all its children

delete 메소드 의 서명은 다음과 같습니다.

  • path – the path of the node
  • version – the expected matching version

프로그램 코드는 다음과 같습니다.

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Time limit is exhausted. Please reload the CAPTCHA.

최신글

에픽게임즈 – Dandara: Trials of Fear Edition

억압받으며 종말의 위기에 처한 기이한 세계에서 Dandara는 세상을 바로잡기 위해 깨어났습니다. 신비한 생물과 끝없는...

인기글

Tomcat 인스턴스 여러개 실행하기

1.tomcat 7 다운로드 tomcat 7 다운로드 2.압축해제 아래의 경로에 압축해제 E:Serverapache-tomcat-7.0.63 3.tomcat 인스턴스 #1 생성 E:Serverinstanceai001에 E:Serverapache-tomcat-7.0.63아래의 conf , logs, temp, work 폴더를 복사합니다. 4.E:Serverinstanceai001bin start, stop bat생성 E:Serverinstanceai001bin 아래의 폴더에 start.bat, stop.bat 생성 start.bat...

ubuntu SNMP 설치 및 설정

ubuntu SNMP 설치 및 설정 1.apt-get snmpd snmp rrdtool 2.snmpd.conf 백업 3.iostat-persist.pl 다운로드 4.snmpd.conf생성 5./etc/default/snmpd 수정 6.service snmpd restart 7.snmpwalk (snmp확인)

Tvheadend 4.4.20171030 로그인 문제 해결방법

Tvheadend 4.4.20171030 로그인 문제 해결방법 tvheadend-testing 4.4.20170707-3 를 설치하게 되면 sc-media 라는 그룹이 생성됨. 아래와 같이 tvheadend 로그인 사용자를 sc-media 그룹에 추가 permission 수정 chown -R sc-tvheadend:tvheadend-testing /var/packages/tvheadend-testing vi...

[이클립스] console 출력 제한 해제

이클립스 console 출력 제한 해제 1.limit console output 체크를 해제하시면됩니다.