0. Installation reference
Note that the new version of Kafka does not need to install zookeeper separately. You can directly use the self-contained one. Of course, you can also install it separately
1. Error message
Kafka startup error: java.net.ConnectException: Connection refused
2. Cause of error
Zookeeper was not started before Kafka was started
3. Solution
Start zookeeper first and then Kafka again
4. Start command
4.1 to Kafka installation directory
cd /usr/src/kafka_2.12-3.1.0/
4.2 start zookeeper (the latest version of the zookeeper from Kafka is used here)
bin/zookeeper-server-start.sh config/zookeeper.properties
4.3 start Kafka
bin/kafka-server-start.sh config/server.properties
4.4 close Kafka
bin/kafka-server-stop.sh config/server.properties