zookeeper 安装单机模式

下载:
建议下载稳定版本,即stable版本。

zookeeper的安装模式有三种:
单机模式(stand-alone):单机单Server
集群模式:多机多Server,形成集群
伪集群模式:单机多个Server,形成伪集群

单机模式:
第一步,获取zookeeper稳定版本安装包,我这里用的是最新的稳定版本: zookeeper-3.4.6.tar.gz,解压缩安装包:
    
    
    
    
  1. [root@liyang home]# tar -zxvf zookeeper-3.4.6.tar.gz
zookeeper 安装单机模式
第二步,修改配置文件zoo.cfg:
    
    
    
    
  1. [root@liyang conf]# cp zoo_sample.cfg zoo.cfg
  2. [root@liyang conf]# vim zoo.cfg
需要对zoo.cfg做如下修改:
    
    
    
    
  1. tickTime=2000
  2. dataDir=/home/zookeeper/data
  3. clientPort=2222
第三步,启动服务:
    
    
    
    
  1. [root@liyang bin]# ./zkServer.sh start
  2. JMX enabled by default
  3. Using config: /home/zookeeper-3.4.6/bin/../conf/zoo.cfg
  4. Starting zookeeper ... STARTED
  5. [root@liyang bin]#
第四步,查看结果:
    
    
    
    
  1. [root@liyang bin]# tail -f zookeeper.out
  2. 2015-08-18 21:42:07,800 [myid:] - INFO [main:Environment@100] - Server environment:os.name=Linux
  3. 2015-08-18 21:42:07,801 [myid:] - INFO [main:Environment@100] - Server environment:os.arch=amd64
  4. 2015-08-18 21:42:07,801 [myid:] - INFO [main:Environment@100] - Server environment:os.version=2.6.32-431.el6.x86_64
  5. 2015-08-18 21:42:07,801 [myid:] - INFO [main:Environment@100] - Server environment:user.name=root
  6. 2015-08-18 21:42:07,802 [myid:] - INFO [main:Environment@100] - Server environment:user.home=/root
  7. 2015-08-18 21:42:07,802 [myid:] - INFO [main:Environment@100] - Server environment:user.dir=/home/zookeeper-3.4.6/bin
  8. 2015-08-18 21:42:07,832 [myid:] - INFO [main:ZooKeeperServer@755] - tickTime set to 2000
  9. 2015-08-18 21:42:07,833 [myid:] - INFO [main:ZooKeeperServer@764] - minSessionTimeout set to -1
  10. 2015-08-18 21:42:07,833 [myid:] - INFO [main:ZooKeeperServer@773] - maxSessionTimeout set to -1
  11. 2015-08-18 21:42:07,914 [myid:] - INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2222

你可能感兴趣的:(zookeeper 安装单机模式)