본문 바로가기


Apache ZooKeeper (아파치 주키퍼) 

분산 코디네이터 설치하기


주키퍼에대한 설명은 아래와 같이 위키백과에서 설명하고 있다.




 

아파치 주키퍼(Apache ZooKeeper)는 

아파치 소프트웨어 재단 프로젝트중의 한 소프트웨어 프로젝트로서 공개 분산형 구성 서비스, 동기 서비스 및 대용량 분산 시스템을 위한 네이밍 레지스트리를 제공한다. 


주키퍼는 하둡의 한 하위 프로젝트이었으나 지금은 독립적인 상위 프로젝트이다. 


주키퍼의 아키텍처는 중복 서비스를 이용한 고가용성을 제공한다. 


클라이언트는 주키퍼 마스터가 응답을 하지 않으면 다른 주키퍼 마스터에게 요청을 한다. 


주키퍼 노드들은 파일 시스템이나 trie 데이터구조와 비슷한 구조의 네임 스페이스안에 데이터들을 저장한다. 클라이언트들은 이 노드들에게서 읽거나 쓴다.



Zookeeper는 단순히, 디렉토리 형태의 데이터 저장소이지만, 

노드의 특성과 기능들을 활용하면 다양하게 사용할 수 있다고 합니다.



본격적으로 설치를 진행하겠습니다.


Zoopkeeper 설치 ( 3.4.10 버전 기준 )


1. 다운로드


공식홈페이지 : http://mirror.navercorp.com/apache/zookeeper/


에서 다운로드를 받거나


wget을 이용하여 받을 수 있습니다.


wget http://mirror.navercorp.com/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz



2. 압축풀기


설치를 원하는 폴더로 이동합니다. ( mv or cp )



이후 해당폴더에서


tar -zxvf zookeeper-3.4.10.tar.gz


ln -s zookeeper-3.4.10.tar.gz zookeeper (선택)



3. 환경설정


환경설정 전 데이터파일 디렉토리를 만들어 줍니다.


ex) /{설치폴더}/zookeeper


vi Zookeeper 설치 디렉토리 / conf / 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=/{설치폴더}/zookeeper

# the port at which the clients will connect

#포트 설정

clientPort=2181

# the maximum number of client connections.

# increase this if you need to handle more clients

#maxClientCnxns=60

#

# Be sure to read the maintenance section of the

# administrator guide before turning on autopurge.

#

# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

#

# The number of snapshots to retain in dataDir

#autopurge.snapRetainCount=3

# Purge task interval in hours

# Set to "0" to disable auto purge feature

#autopurge.purgeInterval=1


server.1={hostname01}:2888:3888

server.2={hostname02}:2888:3888

server.3={hostname03}:2888:3888

#server.{id} = {hostname}:port:port



위와 같이 설정을 변경해 주도록 하자


이후 각 서버에 아이디를 부여한다.


호스트마다 각자의 아이디를 가진 myid 파일을 생성해주어야한다.


데이터디렉토리 바로 아래 myid 라는 아이디 파일 생성


ex) echo 1 > /{설치폴더}/zookeeper/myid



이제 모든 설정이 끝났다.



4. 주키퍼 실행 (모든 노드에서 실행)


{설치폴더}/zookeeper/bin/zkEnv.sh 실행


{설치폴더}/zookeeper/bin/zkServer.sh start




5. 확인


{설치폴더}/zookeeper/bin/zkServer.sh status




Mode에 누가 leader 인지 , follower 인지 확인 가능하다.







이상으로 Apache ZooKeeper (아파치 주키퍼) 분산 코디네이터 설치하기


포스팅을 마치겠습니다.




엉망진창

개인 블로그 입니다. 코딩, 맛집, 정부정책, 서비스, ~방법 등 다양한 정보를 소개합니다