[root@coco kafka_2.13-3.3.1]# bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
#zkServer.sh status 查看服务状态
#zkServer.sh start
#zkServer.sh stop
#zkServer.sh restart
[root@coco bin]# pwd
/root/apache-zookeeper-3.8.0-bin/bin
[root@coco bin]# ./zkServer.sh status
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /root/apache-zookeeper-3.8.0-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone
[root@coco kafka_2.13-3.3.1]# ./bin/kafka-server-start.sh ./config/server.properties
[root@coco kafka_2.13-3.3.1]# bin/kafka-topics.sh –create –topic test-topic –bootstrap-server localhost:9092
Created topic test-topic.
[root@coco kafka_2.13-3.3.1]# bin/kafka-topics.sh –describe –topic test-topic –bootstrap-server localhost:9092
Topic: test-topic TopicId: 0kmY1UHrRtms8ovgmxeTvQ PartitionCount: 1 ReplicationFactor: 1 Configs:
Topic: test-topic Partition: 0 Leader: 0 Replicas: 0 Isr: 0
[root@coco kafka_2.13-3.3.1]# bin/kafka-console-producer.sh –topic test-topic –bootstrap-server localhost:9092
>a
>b
>c
>hello world
>test
>
[root@coco kafka_2.13-3.3.1]# bin/kafka-console-consumer.sh –topic test-topic –from-beginning –bootstrap-server localhost:9092
a
b
c
hello world
test