正文
一、下载文件
链接:https://pan.baidu.com/s/1swrV9ffJnmz4S0mfkuBbIw
提取码:1111
二、解压文件
tar -zxvf kafka_2.12-2.6.2.tgz
三、移动文件到/usr/local
mv kafka_2.12-2.6.2 kafka
四、创建文件夹并授权
mkdir -p /data/zookeeper mkdir -p /data/kafka chown 777 -R /data/zookeeper chown 777 -R /data/kafka
五、修改config/zookeeper.properties
dataDir=/data/zookeeper clientPort=2181 maxClientCnxns=0 admin.enableServer=false
六、修改config/server.properties
broker.id=1 zookeeper.connect=192.168.1.1:2181 listeners=PLAINTEXT://:9092 advertised.listeners=PLAINTEXT://192.168.1.1:9092 log.dirs=/data/kafka
七、启动zookeeper
/usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties
八、启动kafka
/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties
九、查看端口占用
netstat -ntlp
十、创建topic
/usr/local/kafka/bin/kafka-topics.sh --zookeeper 192.168.1.1:2181 --create --topic laokou-elasticsearch --partitions 30 --replication-factor 1
十一、查询topic列表
/usr/local/kafka/bin/kafka-topics.sh --zookeeper 192.168.1.1:2181 --list