kafka搭建
cd /usr/local
wget http://mirror.bit.edu.cn/apache/kafka/2.2.0/kafka_2.11-2.2.0.tgz
下载完成后解压
tar -zxvf kafka_2.11-2.2.0.tgz
cd kafka_2.11-2.2.0
解压后进入看下基本的结构
logs是日志记录的目录,config是基本配置文件的目录。bin是启动目录所在。
首先进入config修改下配置
cd config/
#编辑配置文件
vi server.properties
# The id of the broker. This must be set to a unique integer for each broker.
broker.id=0
# The address the socket server listens on. It will get the value returned from
listeners=PLAINTEXT://172.20.42.10:9092
port=9092
# Zookeeper connection string (see zookeeper docs for details)
zookeeper.connect=localhost:2181
修改后保存。切换到bin目录下:
启动kafka,启动kafka前需要先启动zookeeper。
启动zookeeper命令:
nohup ./zookeeper-server-start.sh /usr/local/kafka_2.11-2.2.0/config/zookeeper.properties &
启动kafka命令:
nohup ./kafka-server-start.sh /usr/local/kafka_2.11-2.2.0/config/server.properties &