Zookeeper construction and error debugging

1. Download the file Wget to the current directory
     Wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz

2. Unzip the file tar -xvzf Current directory
   tar -xvzf zookeeper-3.4.5.tar.gz

3. Configure JAVA_HOME Configure
     in /etc/profile: JAVA_HOME

----------------------- -------------------------------------------------- ---------

Fourth, modify the configuration file
    Modify $ZOOKEEPER/conf/zoo_sample.cfg
    to modify the content of $ZOOKEEPER/conf/zoo.cfg:
     clientPort=2181 
     initLimit=10 
     syncLimit=5 
     tickTime=2000 

     dataDir=/ opt/zookeeper-3.4.5/data
     server.1=master:2888:3888 //master can be the IP address
     server.2=slave1:2888:3888 
     Among them, server.myid represents the machine that constitutes the entire service. When the service starts, the file myid will be looked up in the data directory dataDir.      5. Configure the myid mkdir data touch myid myid content

in the dataDir file path      corresponds to      the vi myid content of server.1 The current machine service id, for example: 1     After the modification is completed, upload all the configured zookeeper files to each child node.     Upload command: scp –r ./zookeeper-3.8.8 192.168.1.202:/opt/ 6. Configure the Hosts file, configure the host name such as mastaer\slave and configure      vi /etc/hosts Add content      192.168.1.201 master //corresponding to the mapped IP address      192.168.1.202 slave 7. Start/check the status. If the status is as follows, the startup is successful./zkServer.sh      start Start          [ZooKeeper JMX enabled by default           Using config: /opt/zookeeper-3.4.8/bin/../conf/zoo .cfg           Starting zookeeper ... STARTED]      ./zkServer.sh start-foreground View startup log












   






     ./zkServer.sh status View status
         [ZooKeeper JMX enabled by default
          Using config: /opt/zookeeper-3.4.8/bin/../conf/zoo.cfg
          Mode: follower] 8. Error debugging    1. View [Startup error ] ./zkServer.sh status If the status is as follows, there is a problem with the startup          [ZooKeeper JMX enabled by default           Using config: /opt/zookeeper-3.4.8/bin/../conf/zoo.cfg           Error contacting service. It is probably not running]    2. Check ./zkServer.sh start-foreground Check the startup log        1) Check the configured myid, host name        2) Check whether the firewall is closed, the general error: [java.net.ConnectException: Connection refused (Connection refused)]    2. View the output log cat zookeeper.out View the output log The solution is as follows:














(1) Ping the host name of other slave nodes from the namenode host (note the host name of the slave node). If the ping fails, the reason may be that the /etc/hosts of the namenode node does not configure the mapping relationship between the host name and the IP address, complete it The mapping relationship between host names and IP addresses.

(2) Ping the host name of the master node from the datanode host (note that it is also the host name of the node), if the ping fails, the reason may be that the /etc/hosts of the datenode node does not configure the mapping relationship between the host name and the IP address, and complete the host name Mapping relationship with IP addresses.

(3) Check whether the firewall of each machine node is closed (or set the firewall to be open, but open to our designated port, it is best to close the firewall):
Check the status of the firewall for different versions of Linux systems, and close the firewall:
-- -------------------------------------------------- -----------
Ubuntu (ubuntu-12.04-desktop-amd64)
View firewall status: ufw status
Turn off firewall: ufw disable
------------------ ----------------------------------------------
centos6.0
view firewall Status: service iptables status
Turn off the firewall: chkconfig iptables off #Do not start the firewall service
--------------------------------- -----------------------------
centos7.0 (default is to use firewall as the firewall, if not changed to iptables firewall, use the following commands to view and close the firewall)
Check the firewall status: firewall-cmd --state
Stop the firewall: systemctl stop firewalld.service
prohibit the firewall from starting: systemctl disable firewalld.service


















Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326448456&siteId=291194637