주키퍼 와 카프카

2021. 2. 15. 10:26
728x90

카프카 분산 ->어플리케이션

주키퍼       - >하둡 진영의 분산 코디네이터

 

 

주키퍼

https://zookeeper.apache.org/releases.html

카프카 

http://kafka.apache.org

 

주키퍼 설치 

 

1. 원하는 폴더에 압축 파일을 옮긴 후, Command(cmd) 창을 열고 해당 위치로 가서 tar -xvf [주키퍼파일]을 입력한다.

 

2. 주키퍼 폴더에 data라는 폴더를 생성한다.

 

3. conf 폴더 안에 있는 zoo_sample.cfg 파일을 zoo.cfg 파일로 명칭을 변경한다.

 

4. 파일 안에 있는 dataDir 값을 data로 수정한다.

 

5. 주키퍼의 bin 폴더로 간 후, zkServer.cmd 파일을 실행한다.
ex)로그가 떠야지 성공 

 

카프카설치

 

1. Kafka 사이트에 들어간 후 우측 상단의 download 아이콘을 클릭한다.

2. 다운로드 페이지에서 Binary downloads의 Scala로 된 파일중 한개를 다운로드 한다.

3. 원하는 위치로 파일을 이동 후, tar -xvf [카프카파일]로 압축을 해제한다.

 

Command 창을 열 고, 카프카 설치폴더/bin/windows 폴더로 이동

 

kafka-server-star.bat ../../config/server.properties

 

--------------토픽생성

kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions --topic testtopic

--------------토픽생성 확인

 

 

데이터 주고 받기 테스트 

수신자

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic [토픽명]

 

송신자  따로 cmd 창 열어서  

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic [토픽명]

cmd -> 주키퍼 /bin 폴더

zkCli.cmd 명령어 실행  

ls /brokers/topics 입력

testtopic 이 있는것 학인가능

728x90