多多点赞,会变好看!
多多留言,会变有钱!
前台启动:
./bin/zookeeper-server-start.sh config/zookeeper.properties
后台启动:
./bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
./bin/zookeeper-server-stop.sh
前台启动:
./bin/kafka-server-start.sh config/server.properties
后台启动:
./bin/kafka-server-start.sh -daemon config/server.properties
./bin/kafka-server-stop.sh
创建一个叫demo-topic的主题(topic),有两个分区,每个分区3个副本,同时指定该主题的消息保留时长(72小时):
./bin/kafka-topics.sh --zookeeper(host:port) --create --topic demo-topic --replication-factor 3 --partitions 2 --topic test --retention-hours 72
单机创建主题
bin/kafka-topics.sh --create --replication-factor 1 --partitions 1 --topic test --bootstrap-server localhost:9092
./bin/kafka-topics.sh --list --bootstrap-server localhost:9092
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
没有zookeeper:
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
./bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test
没有zookeeper:
./bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic test
- #/bin/bash
- #启动zookeeper
- bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
-
- #启动kafka
- bin/kafka-server-start.sh -daemon config/server.properties
- #/bin/bash
- #停止zookeeper
- bin/kafka-server-stop.sh
- #停止kafka
- bin/zookeeper-server-stop.sh