zookeeper--starting a zookeeper FAQ

Source: Internet
Author: User
Tags zookeeper iptables

Original address: http://hi.baidu.com/luhao8415/item/23c6e7f075aa18b730c1993a

Recently often started zookeeper problems, the collation of the post, later can also refer to the reference.

1. Noclassfound and other errors occur after starting zookeeper, for example:

Exception in thread "main" Java.lang.NoSuchMethodError:method Java.lang.management.ManagementFactory.getPlatformMBeanServer with signature () Ljavax.management.MBeanServer; Was is not found.

At Org.apache.zookeeper.jmx.ManagedUtil.registerLog4jMBeans (managedutil.java:48)

At Org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig (quorumpeermain.java:114)

At Org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun (quorumpeermain.java:103)

At Org.apache.zookeeper.server.quorum.QuorumPeerMain.main (quorumpeermain.java:7

This may be because the JDK version of the server is incorrect, or the environment variable is not set.

For example, the original Linux is already installed jdk-1.4, and then install a new version of jdk-1.6, we follow the online tutorial steps to install the zookeeper and set the environment variables,

echo $JAVA _home show java-1.6,

However, with the Java-version command, the java-1.4 is still displayed, stating that the environment variable is not well-equipped. The JDK version read by Zookeeper is still an older version of jdk-1.4.

The workaround is at the end of the/ETC/BASHRC file,

Export java_home=/usr/java/jdk1.6.0_23

Export Jre_home= $JAVA _home/jre

Export path= $JAVA _home/bin: $PATH

It should be noted here that the $path should be placed on the tail instead of the head, and there is an installation tutorial on the Web that reads $path: $JAVA _home/bin, so zookeeper will read the old JDK in $path error.

Export classpath=.: $JAVA _home/lib/*.jar

2. When a computer or a machine repeatedly appears cannot open channel to xxxx:2888/3888, error (such as unable to synchronize with leader and so on), unable to complete the election (this error has been in the past, but sometimes no, do not know why).

The possible reason is that the firewall is turned on, causing the port of a machine not to open, usually 2888 cannot be turned on. Many distributed applications under Linux require the firewall to be turned off ... So just shut it down anyway. Today the firewall is shut down directly after the zookeeper starts normally.

Use the command service iptables status to view a series of messages indicating that the firewall is on, and you can turn off the firewall with service iptables stop. But this is just a temporary shutdown of the firewall.

For the system to start without automatically starting the firewall, you can use the command chkconfig–list iptables to view the firewall information, Chkconfig iptables off the firewall. To open later, use the Chkconfig iptables on command.

---

PS this morning to see the firewall has been opened again, seemingly no use. Or, use the following three commands to close the line.

Chkconfig--level iptables off;/etc/init.d/iptables stop; Iptables-p INPUT DROP

3. Zookeeper can start normally, but the following error is displayed:

Starting zookeeper ...

./zkserver.sh:line:/home/sysdata/zookeeper/zookeeper-data/zookeeper_server.pid:no such file or directory

STARTED

The generated location for the PID file that zookeeper started was specified in the configuration file Zoo.cfg file: Datadir=/home/sysdata/zookeeper/zookeeper-data, but we found that the PID was not generated. And to stop zookeeper is obviously not successful:

Stopping zookeeper ...

Error:could not find File/zookeeper_server.pid.

After consulting Daniel, the problem that let me have a long headache, finally solved ...

It turns out that my zoo.cfg file has one more space before assigning a value to the DataDir path. Zookeeper read this configuration file will also read the space in the file name (script how this is not smart), the space is deleted after zookeeper startup, shutdown is normal.

Zoo.cfg file is not smart, there is a note when the # is also added a space behind.



Others: http://blog.csdn.net/shenlan211314/article/details/6187034

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.