Install zookeeper under Ubuntu

Source: Internet
Author: User
Tags zookeeper

Install the Java environment and configure the Java-related environment variable $java_home.

1, download and extract the latest stable zookeeper files

wget http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

TAR-ZXVF zookeeper-3.4.6.tar.gz

The executable files are in the bin/directory, and the configuration is in the conf/directory

2. Generate Configuration file

conf/Directory has a zoo_sample.cfg, is a template configuration file
Copying a copy into zoo.cfg
There are two more important configurations:
Datadir=/home/gradven/zookeeper-3.4.6/data # Data storage location, can be modified as needed
CLIENTPORT=2181 # Service Listening port, can be modified as needed.

3. Start the service
bin/zkserver.sh start
If it does not start successfully, a check whether the Java_home is set correctly, two see if the port is conflicting

4. Start the client test
Start command:
Bin/zkcli.sh-server 127.0.0.1:2181

Displays the root directory, files:
LS/

Create the file and set the initial content:

[Zk:127.0.0.1:2181 (CONNECTED) 1] create/treeroot Hello
Created/treeroot
[Zk:127.0.0.1:2181 (CONNECTED) 2] Get/treeroot
Hello
Czxid = 0x2
CTime = Tue Oct 00:30:34 CST 2015
Mzxid = 0x2
Mtime = Tue Oct 00:30:34 CST 2015
Pzxid = 0x2
cversion = 0
dataversion = 0
aclversion = 0
Ephemeralowner = 0x0
Datalength = 5
Numchildren = 0
[Zk:127.0.0.1:2181 (CONNECTED) 3] Delete/treeroot
[Zk:127.0.0.1:2181 (CONNECTED) 4]

To exit the client:
Quit

View the status of zookeeper

[Email protected]:~/zookeeper-3.4.6$ bin/zkserver.sh Status
JMX enabled by default
Using config:/home/gradven/zookeeper-3.4.6/bin/. /conf/zoo.cfg
Mode:standalone

Restart Zookeeper command

[Email protected]:~/zookeeper-3.4.6$ bin/zkserver.sh status
JMX enabled by default
Using config:/home/gradven/zookeeper-3.4.6/bin/. /conf/zoo.cfg
Mode:standalone
[Email protected]:~/zookeeper-3.4.6$ bin/zkserver.sh Restart
JMX enabled by default
Using config:/home/gradven/zookeeper-3.4.6/bin/. /conf/zoo.cfg
JMX enabled by default
Using config:/home/gradven/zookeeper-3.4.6/bin/. /conf/zoo.cfg
Stopping zookeeper ... STOPPED
JMX enabled by default
Using config:/home/gradven/zookeeper-3.4.6/bin/. /conf/zoo.cfg
Starting zookeeper ... STARTED

Install zookeeper under Ubuntu

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.