반응형

카프카와 주키퍼는 한몸이다. 카프카와 주키퍼는 메시징서버다...나도 잘 모른다.. 일단 설치해보자..


우선 우분투에 자바를 설치한다.


#apt-get install default-jdk


설치가 다되면 제대로 설치했는지 버전을 확인해보자...


#javac -version

javac 10.0.2


이렇게 나오면 된다...


그리고 서버의 호스트네임을 변경한다...


#hostname kafka1


그다음


#vi /etc/hosts


이 파일을 열어서


127.0.0.1 localhost

127.0.0.1 kafka1

0.0.0.0 kafka1

192.168.0.2 kafka2

192.168.0.3 kafka3


위처럼 입력해준다...


총 3대를 설치할거라서 kafka1, 2, 3 이렇게 입력한다...나중에 서버를 구분할때 유용하다. 



1. 먼저 주키퍼를 설치해보자...


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


주키퍼를 다운받아서 압축을 푼다.


#tar zxvf zookeeper-3.4.13.tar.gz


그냥 현재 디렉토리에 풀었다. 현재 디렉토리는  /root 다...


그러면 /root/zookeeper-3.4.13 이라는 디렉토리에 풀린다...


저 경로를 다 치면 귀찮으니까 심볼릭 링크를 걸어준다.


#ln -s zookeeper-3.4.13 zookeeper


이렇게 해준다...


제일 먼저 설치해주는 서버가 카프타와 주키퍼 1번 서버다. 1번서버라는것을 기억시켜준다.


#mkdir /data


#echo 1 > /data/myid


myid 파일에 1을 넣는다.


#vi /data/myid


로 확인해보고 값이 없으면 1이라고 넣어준다...


같은 방식으로 2번째 3번째 서버에서 2와 3을 넣어준다...


이제 주키퍼 설정을 해보자...


#cd zookeeper/conf


여기에 가보면 zoo_sample.cfg 파일이 있다. 샘플 파일을 실제 설정파일로 만들어준다.


#cp zoo_sample.cfg 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=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=kafka1:2888:3888
server.2=kafka2:2888:3888
server.3=kafka3: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


이렇게 뜨면 성공한거다....

항상 주키퍼먼저 실행하고 카프카를 실행해줘야한다...

멈출땐 stop 옵션을 주면 된다...

다음엔 카프카를 설치해보자...






반응형

+ Recent posts