CentOS Linux 7.7 安装kafka zookeeper
原创
©著作权归作者所有:来自51CTO博客作者gblfy的原创作品,请联系作者获取转载授权,否则将追究法律责任
文章目录
一、软件下载
1. zookeeper
http://archive.apache.org/dist/zookeeper/zookeeper-3.5.7/apache-zookeeper-3.5.7-bin.tar.gz
2. kafka
https://archive.apache.org/dist/kafka/2.4.0/kafka_2.11-2.4.0.tgz
二、安装与启动
2.1. jdk
2.2. zookeeper
cd /opt/spftware
tar -zxf apache-zookeeper-3.5.7-bin.tar.gz -C /opt/install
cd /opt/install
mv apache-zookeeper-3.5.7-bin zookeeper-3.5.7
cd zookeeper-3.5.7/conf
cp zoo_sample.cfg zoo.cfg
cd zookeeper-3.5.7/bin
./zkServer.sh start
ps -ef |grep
2.3. kafka
三、 kafka 基本演示
1、启动Kafka
bin/kafka-server-start.sh config/server.properties &
2、停止Kafka
bin/kafka-server-stop.sh
3、创建Topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic gblfy-topic
4、查看已经创建的Topic信息
bin/kafka-topics.sh --list --zookeeper localhost:2181
5、发送消息
bin/kafka-console-producer.sh --broker-list 192.168.60.128:9092 --topic gblfy-topic
6、接收消息
bin/kafka-console-consumer.sh --bootstrap-server 192.168.60.128:9092 --topic gblfy-topic --from-beginning
{"orderId":"002","price":"80"}