Zookeeper starts, sometimes there is no real start. So how do we find the error, and we can view the zookeeper.out file below the zookeeper directory, and you can check the error. Zookeeper.out file is more important. It is essential for wrong investigation. There are also servers. If the connection is not connected, it may be a problem with the firewall.
When it is settled, the directory structure of the data storage, in each Zookeeper, requires LOGS (log storage) and data (data storage) directory and MyID files under the data directory.
This problem is due to the ID of the service, which is configured in myid, the ID of the service, which needs to be consistent with the configuration file of the zoo.cfg, otherwise the error is reported.
# The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. # Data storage location dataDir=/tmp/zookeeper1/data # Log file dataLogDir=/tmp/zookeeper1/logs # the port at which the clients will connect clientPort=2181 # Server.num = IP: Port1: Port2 NUM indicates that the machine is No. 1 server; IP is the IP address of this machine; # Port1 is a communication port for Leader and Follower; PORT2 is the communication port to participate in the leader # The port configuration of multiple instances cannot be repeated server.1=127.0.0.1:2222:2225 server.2=127.0.0.1:3333:3335 server.3=127.0.0.1:4444:4445
Server.a = B: C: D: Among them, A is a number, which is the number in myid, indicating that this is the number of the number No. 1; B is the IP address of this server, C and D are two ports.
Configuration file MyID file configuration has problems and the inconsistency of ZOO.CFG
The reason for
Caused by: java.lang.IllegalArgumentException: /usr/local/zookeeper/zookeeper-3.4.10/data/data/myid file is missing
This problem is that there are problems with the configuration of the MyID file. It may be that the path is wrong, or the file is not. You need to create a MyID file in your own data directory. The path configuration
The reason for this problem is that there are no problems caused by all Zookeeper nodes. All nodes are started, and there will be no such problem.
In the startup cluster, only 2 and 3 nodes are in the cluster, but 1 node is Standalone
View node information zkServer.sh status
The reason for this problem is port occupation
# View port netstat -lnp|grep 2181 # Kill the process, and then restart Zookeeper killProcess number