step1、配置java环境,在挂网下载kafka_2.12-2.7.0
step2、
tar -zxvf kafka_2.12-2.7.0.tgz -C /usr/src/ chown -R root:root /usr/src/kafka_2.12-2.7.0/ #设置属主和属组 cd /usr/src/kafka_2.12-2.7.0/
step3、修改配置文件
vim server.properties broker.id =0 每一个broker在集群中的唯一表示,要求是正数。 listeners=PLAINTEXT://127.0.0.1:9092 监听端口 zookeeper.connect=127.0.0.1:2181 zook的端口 zookeeper.connection.timeout.ms=60000 ZooKeeper的最大超时时间 vim zookeeper.properties clientPort=2181 #监听端口
step4、关闭防火墙
systemctl stop firewalld
step5、启动
5.1、启动zookeeper
[root@localhost config]# cd /usr/kafka [root@localhost kafka]# ./bin/zookeeper-server-start.sh -daemon ./config/zookeeper.properties [root@localhost kafka]# netstat -anpt | grep 2181
5.2、启动kafka
[root@localhost kafka]# ./bin/kafka-server-start.sh -daemon ./config/server.properties
5.3、关闭zk
[root@localhost kafka]# ./bin/zookeeper-server-stop.sh ./config/zookeeper.properties
5.4、关闭kafka
[root@localhost kafka]# ./bin/kafka-server-stop.sh ./config/server.properties
5.5、创建topic
[root@localhost kafka]# ./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
5.6、查看topic
[root@localhost kafka]# ./bin/kafka-topics.sh --list --zookeeper localhost:2181
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)