반응형

테스트 서버는 총 3대가 필요하다...

 

첫번째 서버에 다음과 같이 설치한다...

 

1. 우선 자바를 설치한다.(root 권한으로)

 

#yum list java*jdk-devel

 

리스트가 나오면 그중에

 

#yum install java-1.8.0-openjdk-devel.x86_64

 

이놈으로 설치한다...

 

그리고 hostname을 변경해준다.

 

#hostname

blockChain01

 

#vi /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost4 localhost4.localdomain4

192.10.0.1    blockChain01
192.10.0.2    blockChain02
192.10.0.3    blockChain03

 

이렇게 입력해주고 저장한다.

 

2. 주키퍼를 설치한다. 주키퍼를 다운받자.

 

http://apache.tt.co.kr/zookeeper/stable/

 

Index of /zookeeper/stable

 

apache.tt.co.kr

 

위 주소에 가서 다운로드 주소를 가져와서..

 

#wget http://apache.tt.co.kr/zookeeper/stable/zookeeper-3.4.14.tar.gz

불러오는 중입니다...

다운받는다..

 

#tar zxvf zookeeper-3.4.14.tar.gz

불러오는 중입니다...

#ln -s zookeeper-3.4.14 zookeeper

 

심볼릭 링크도 걸어준다...

 

그리고 디렉토리를 하나 만들어서 현재 설치하고 있는 서버의 고유 아이디를 입력해준다.

 

#mkdir /data

#echo 1 > /data/myid

#cat /data/myid

 

해보면 1이 들어가있다. 1번서버라는 의미다...2번서버는 2, 3번서버는 3을 입력한다.

 

주키퍼 설정 파일을 만들어보자

 

#cd zookeeper/conf/

 

여기 가보면 zoo_sample.cfg 파일이 있다. 이파일을 사용한다.

 

#cp zoo_sample.cfg zoo.cfg

불러오는 중입니다...

#vi 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=/data

# 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=4096

#

# 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=blockChain01:2888:3888

server.2=blockChain02:2888:3888

server.3=blockChain03:2888:3888

//////////////////////////////////////////////////////////////////

 

파일을 열어서 dataDir과 맨 아랫부분에 서버의 호스트네임을 적어서 저장한다.

 

이제 실행해보자..

 

#/root/zookeeper/bin/zkServer.sh start

ZooKeeper JMX enabled by default
Using config: /root/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

 

STARTED라고 뜨면 성공한거다...

 

#tail -f /root/zookeeper.out

 

으로 로그도 확인해보자..

 


#/root/zookeeper/bin/zkServer.sh stop

 

중단한다.

반응형

+ Recent posts