First confirm whether the configuration id in the zoo.cfg file is consistent with myid
server.A=B:C:D
A is a number, indicating which server number this is;
Configure a file myid in cluster mode. This file is in the dataDir directory. There is a data in this file that is the value of A. Zookeeper reads this file when it starts, and compares the data in it with the configuration information in zoo.cfg to judge Which server is it?
B is the ip address of this server;
C is the port where this server exchanges information with the Leader server in the cluster;
D is in case the Leader server in the cluster hangs up, a port is needed to re-elect to elect a new Leader, and this port is the port used to communicate between the servers during the election.
Caused by: java.lang.IllegalArgumentException: /usr/local/zookeeper/zookeeper-3.4.10/data/data/myid file is missing
The reason for this problem is that there is a problem with the configuration of the myid file. The cause may be that the path is wrong, or there may be no file. You need to create a myid file in your own data directory. The number inside needs to be the same as the path you define. configured
Cannot open channel to 1 at election address /127.0.0.1:2225
The reason for this problem is that all zookeeper nodes are not fully started. If all nodes are started, there will be no such problem.
Address already used:
It is possible that the port is already occupied by another service.
You need to use the command to view the port netstat -lnp|grep 2181
See what services try to avoid when starting up after occupying the port
Then
kill -9 process number
kill process
Start zookeeper
No error but no error:
Just go to zookeeper.out to view the log
Solve according to the error