下载
wget archive.apache.org/dist/kafka/2.8.1/kafka_2.12-2.8.1.tgz
tar -zxvf kafka_2.12-2.8.1.tgz
mv kafka_2.12-2.8.1 /usr/local/
生成集群ID
#cd /usr/local/kafka_2.12-2.8.1
#./bin/kafka-storage.sh random-uuid
i7VXnngcSQiiIMb3PqXRnA
格式化存储目录
修改
40 listeners=PLAINTEXT://10.1.102.232:9092,CONTROLLER://:9093
41 inter.broker.listener.name=PLAINTEXT
46 advertised.listeners=PLAINTEXT://10.1.102.232:9092
74 log.dirs=/usr/local/kafka_2.12-2.8.1/tmp/kraft-combined-logs
你使用的多节点安装,你需要在每个节点上执行格式化命令,并确保每个节点使用的集群ID是相同的。
# ./bin/kafka-storage.sh format -t i7VXnngcSQiiIMb3PqXRnA -c config/kraft/server.properties
Formatting /usr/local/kafka_2.12-2.8.1/tmp/kraft-combined-logs
启动Kafka服务
./bin/kafka-server-start.sh ./config/kraft/server.properties
创建
老
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic datainfo
新
# ./bin/kafka-topics.sh --create --topic test --partitions 1 --replication-factor 1 --bootstrap-server 10.1.102.232:9092
Created topic test.
查看
./bin/kafka-topics.sh --list --zookeeper localhost:2181
# ./bin/kafka-topics.sh --list --bootstrap-server 10.1.102.232:9092
test
# ./bin/kafka-console-producer.sh --broker-list 10.1.102.232:9092 --topic test
>
# ./bin/kafka-console-consumer.sh --bootstrap-server 10.1.102.232:9092 --topic test --from-beginning
ni hao ya
阅读(1547) | 评论(0) | 转发(0) |