首先需要安装jdk,参考之前的文章:Ubuntu 13.10-14.10 安装Oralce JDK
然后下载最新稳定版本到/opt目录
/opt$ wget http://mirrors.cnnic.cn/apache/zookeeper/stable/zookeeper-3.4.6.tar.gz
tar zxvf zookeeper-3.4.6.tar.gz
/opt/zookeeper-3.4.6$ tree -L 1 . ├── bin ├── build.xml ├── CHANGES.txt ├── conf ├── contrib ├── dist-maven ├── docs ├── ivysettings.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
cd conf/ $ cp zoo_sample.cfg zoo.cfg编辑zoo.cfg文件,修改data目录路径,注释都解释了各个参数的作用:
# The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. dataDir=/opt/zk_data # the port at which the clients will connect clientPort=2181
mkdir /opt/zk_data
:/opt/zookeeper-3.4.6/conf$ cd .. :/opt/zookeeper-3.4.6$ bin/zkServer.sh start JMX enabled by default Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
原文地址:http://blog.csdn.net/csfreebird/article/details/44006453