[Zookeeper] Zookeeper installation configuration and zookeeper installation Configuration
Upload to linux server,
Run the following command to decompress the package to the/usr/local/directory:
Go to the/usr/local/directory and rename the zookeeper folder to zookeeper.
Run vi/etc/profile to modify the system configuration and add the following configuration
After modification, execute source/etc/profile to make the configuration file take effect.
Next, go to the/usr/local/zookeeper/conf directory and change zoo_sample.cfg to zoo. cfg,
Modify the zoo. cfg file as follows:
Server.0 = 192.168.1.103: 2888: 3888
Server.1 = 192.168.1.106: 2888: 3888
Server.2 = 192.168.1.105: 2888: 3888
The three IP addresses correspond to the three server addresses.
Go back to the/usr/local/zookeeper directory, execute mkdir data to create the data directory, then enter the data directory, execute vi myid to create and edit the myid file, before that, the operations on the three servers are the same. Then, the server whose IP address is 192.168.1.103 enters 0 in myid, and the server whose IP address is 192.168.1.106 enters 1 in myid, then, enter 2 in myid for the server whose IP address is 192.168.1.105, which corresponds to the preceding Configuration:
Server.0 = 192.168.1.103: 2888: 3888
Server.1 = 192.168.1.106: 2888: 3888
Server.2 = 192.168.1.105: 2888: 3888
Now you can start zookeeper and execute zkServer. sh start (environment variables are configured before and can be executed in any directory). Note that zookeeper depends on the java environment. Remember to install zookeeper in advance.
After all three instances are started, first check the thread method to see if the startup is successful and run ps-an | grep zookeeper. The following information proves that the startup is successful.
Then, run zkServer. sh status to check the status of zookeeper. The following information shows that the status is successfully viewed. One leader and two follower instances are displayed.
Note: It is possible that the startup is successful after zkServer. sh start is executed, but the following is displayed when you use zkServer. sh status to view the status:
Here, zookeeper of version 3.4.5 is used. After a review, the firewall is disabled to solve this problem. Run the command to close the firewall. The CentOS version 7.2 is used here, use the following command to disable it (firewalld is used by default after CentOS 7 ):
Sudo systemctl stop firewalld. service & sudo systemctl disable firewalld. service
In versions earlier than 7, disable service iptables stop and use service iptables status to check the status. You can also use chkconfig iptables off to disable the firewall to Prevent Automatic restart after the next boot.