First you need to install the JDK, refer to the previous article: Ubuntu 13.10-14.10 installation Oralce JDK
Then download the latest stable version to the/OPT directory
/opt$ wget http://mirrors.cnnic.cn/apache/zookeeper/stable/zookeeper-3.4.6.tar.gz
Unzip directory:
The directory structure after decompression is:
/opt/zookeeper-3.4.6$ tree-l 1.├──bin├──build.xml├──changes.txt├──conf├──contrib├──dist-maven├──docs├──ivysettin gs.xml├──ivy.xml├──lib├──license.txt├──notice.txt├──readme_packaging.txt├──readme.txt├──recipes├──src├── Zookeeper-3.4.6.jar├──zookeeper-3.4.6.jar.asc├──zookeeper-3.4.6.jar.md5└──zookeeper-3.4.6.jar.sha1
Go to the Conf directory and copy the sample configuration file
CD conf/$ CP zoo_sample.cfg zoo.cfg
Edit the Zoo.cfg file, modify the Data directory path, and the annotations explain the role of each parameter:
# The number of milliseconds of each tickticktime=2000# the number of ticks, the initial # synchronization phase can T akeinitlimit=10# the number of ticks so can pass between # Sending a request and getting an acknowledgementsynclimit=5# The directory where the snapshot is stored.# does not use/tmp for storage,/tmp here is just # example sakes.datadir=/opt/z k_data# the port at which the clients would connectclientport=2181
Create a Directory
Mkdir/opt/zk_data
Start the service now:
:/opt/zookeeper-3.4.6/conf$ CD.:/ opt/zookeeper-3.4.6$ bin/zkserver.sh startjmx enabled by defaultusing Config:/opt/zookeeper-3.4.6/bin/. /conf/zoo.cfgstarting Zookeeper ... STARTED
Zookeeper Standalone mode installation