2 安装JDK 配置环境变量 (本人安装的是jdk1.8.0_111)
安装方式 参考 http://blog.csdn.net/feng_qi_1984/article/details/54709398
3 讲安装包放入Linux 目录下 我是放在了 /usr/zk 的目录下 (我下载的是zookeeper-3.4.8.tar.gz)
创建/usr/zk目录 # mkdir /usr/zk
将压缩包上传至该目录即可
4 解压zookeeper压缩包
# cd /usr/zk
# tar -zxvf zookeeper-3.4.8.tar.gz
5 进入zookeeper目录中的conf目录
6 将 zoo_sample.cfg 文件复制一份 起名叫 zoo.cfg
# cp zoo_sample.cfg zoo.cfg
7 编辑 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 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=/tmp/zookeeper/data dataLogDir=/tmp/zookeeper/log # the port at which the clients will connect clientPort=2181 # the maximum number of client connections. # increase this if you need to handle more clients #maxClientCnxns=60 # # Be sure to read the maintenance section of the 主要是修改dataDir和DataLogDir路径 这两个路径必须要存在 如果不存在可以手动创建
8 配置zookeeper环境变量
将目录切入 # cd /etc/profile.d
编辑脚本 # vi zookeeper.sh
ZOOKEEPER=zk的根目录 PATH=$PATH:$ZOOKEEPER/bin export ZOOKEEPER PATH
保存退出后 执行source命令使文件立即生效 # source zookeeper.sh
9启动zk # zkServer.sh start
