[ Ubuntu ]
* 사전설치 Python3
sudo apt-get upgrade
# Pip설치
sudo apt-get install python3-pip
#Kafka Lib 설치
sudo pip3 install kafka-python
[ 테스트 코드 ]
from kafka import KafkaProducer
import time
producer = KafkaProducer(bootstrap_servers=[ '172.31.11.11:9092', '172.31.22.222:9092', '172.31.33.33:9092' ])
for i in range(1,50):
producer.send( 'Topic-Name', str.encode('kafka:-%d' % i) )
time.sleep(0.5)
댓글 없음:
댓글 쓰기