1、http://mirrors.cnnic.cn/apache/zookeeper/stable/zookeeper-3.4.9.tar.gz 下载zookeeper的地址
2、安装zookeeper
1)操作linux命令tar -xzvf zookeeper-3.4.9.tar.gz解压下载的zookeeper
2)进入zookeeper-3.4.9目录下的conf目录,执行copy命令cp zoo_sample.cfg zoo.cfg
3 )编辑zoo.cfg,执行vi zoo.cfg,修改为
# 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=/software/zookeeper-3.4.9/data
dataLogDir=/software/zookeeper-3.4.9/logs
# the port at which the clients will connect
clientPort=2181
server.1=localhost:2888:3888
在/software/zookeeper-3.4.9/ 创建data和logs文件
4)设置环境变量
执行linux命令 vi /etc/profile 输入“i” 进入insert模式, 在配置文件追加 :
ZOOKEEPER=/software/zookeeper-3.4.9
PATH=$PATH:$ZOOKEEPER/bin
输入“Esc”键,退出insert模式,:wq 保存并退出
输入命令source /etc/profile 编译该文件
5)启动服务
进入zookeeper的bin目录,./zkServer.sh start 启动,查看是否启动成功./zkServer.sh status 如果启动失败,可能是linux防火墙没有关闭,执行
chkconfig iptables off 关闭即可