[Solved] The solution to the failure to start the zookeeper in the kafka configuration

In the process of kafka configuration, start zookeeper first, and then start kafka, because zookeeper is a configuration management service of kafka.

After all the previous configuration files are configured, start: In the bin directory: ./zkServer.sh start, the startup is successful, and then check the status: ./zkServer.sh status

If the following problems occur:

Go to the logs directory to view the logs to find the routing problem.

Then go to see if the ip address in /etc/hosts is wrong: the error here is because the file ip in the previous file only wrote one virtual machine, and then all three were added, and then go to check /opt/apache -zookeeper-3.6.3-bin/conf/zoo.cfg.

Among them, zoo.cfg is copied: cp zoo_sample.cfg zoo.cfg.

And turn off zookeeper: ./zkService.sh stop (all three virtual machines are closed)

[root@nginx-kafka01 bin]./zkService.sh stop

There is nothing wrong with the discovery, and there is still a problem with the implementation, then you need to delete the data and version before the modification.

[root@nginx-kafka01 bin]# cd /tmp/zookeeper/
[root@nginx-kafka01 zookeeper]# ls
myid version-2
[root@nginx-kafka01 zookeeper]# rm -rf version-2/

Virtual machines need to do this.

Then restart it again and succeed. This is the flower machine, which is randomly assigned.

[root@nginx-kafka01 bin]# cd /tmp/zookeeper/
[root@nginx-kafka01 zookeeper]# ls
myid version-2
[root@nginx-kafka01 zookeeper]# rm -rf version-2/
[root@nginx-kafka01 zookeeper]# cd /opt/apache-zookeeper-3.6.3-bin
[root@nginx-kafka01 apache-zookeeper-3.6.3-bin]# ls
bin docs LICENSE.txt NOTICE.txt README_packaging.md
conf lib logs README.md
[root@nginx-kafka01 apache-zookeeper-3.6.3-bin]# cd bin
[root@nginx-kafka01 bin]# ls
README.txt zkEnv.sh zkSnapShotToolkit.sh
zkCleanup.sh zkServer.cmd zkTxnLogToolkit.cmd
zkCli.cmd zkServer-initialize.sh zkTxnLogToolkit.sh
zkCli.sh zkServer.sh
zkEnv.cmd zkSnapShotToolkit.cmd
[root@nginx-kafka01 bin]# ./zkServer.sh start
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.6.3-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@nginx-kafka01 bin]# ./zkServer.sh status
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.6.3-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: follower