分享

Linux环境下安装 zookeeper

 化蝶学院 2017-09-23

Zookeeper使用java语言编写,所以它的运行环境需要java环境的支持

下载地址 http://mirrors./apache/zookeeper/

下载stable路径下的版本

1.解压Zookeeper的安装包

[root@localhost software]# tar zxf zookeeper-3.4.8.tar.gz 
[root@localhost software]# 

2.在Zookeeper的当前目录下创建一个data文件夹

[root@localhost zookeeper-3.4.8]# mkdir data

3.将conf文件夹下的zoo_sample.cfg复制一份,改名为zoo.cfg

复制代码
[root@localhost zookeeper-3.4.8]# cd conf
[root@localhost conf]# ll
total 12
-rw-rw-r--. 1 1000 1000  535 Feb  6  2016 configuration.xsl
-rw-rw-r--. 1 1000 1000 2161 Feb  6  2016 log4j.properties
-rw-rw-r--. 1 1000 1000  922 Feb  6  2016 zoo_sample.cfg
[root@localhost conf]# cp zoo_sample.cfg zoo.cfg
[root@localhost conf]# ll
total 16
-rw-rw-r--. 1 1000 1000  535 Feb  6  2016 configuration.xsl
-rw-rw-r--. 1 1000 1000 2161 Feb  6  2016 log4j.properties
-rw-r--r--. 1 root root  922 May 12 02:26 zoo.cfg
-rw-rw-r--. 1 1000 1000  922 Feb  6  2016 zoo_sample.cfg
[root@localhost conf]# 
复制代码

4.修改配置dataDir属性,制定一个真实的目录

复制代码
[root@localhost conf]# vim 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=/usr/local/software/zookeeper-3.4.8/data
# 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 
# administrator guide before turning on autopurge.
#
# http://zookeeper./doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
复制代码

5.第五步

开启、关闭、查看状态命令

复制代码
[root@localhost bin]# ll
total 36
-rwxr-xr-x. 1 1000 1000  232 Feb  6  2016 README.txt
-rwxr-xr-x. 1 1000 1000 1937 Feb  6  2016 zkCleanup.sh
-rwxr-xr-x. 1 1000 1000 1056 Feb  6  2016 zkCli.cmd
-rwxr-xr-x. 1 1000 1000 1534 Feb  6  2016 zkCli.sh
-rwxr-xr-x. 1 1000 1000 1628 Feb  6  2016 zkEnv.cmd
-rwxr-xr-x. 1 1000 1000 2696 Feb  6  2016 zkEnv.sh
-rwxr-xr-x. 1 1000 1000 1089 Feb  6  2016 zkServer.cmd
-rwxr-xr-x. 1 1000 1000 6773 Feb  6  2016 zkServer.sh
[root@localhost bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/software/zookeeper-3.4.8/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/software/zookeeper-3.4.8/bin/../conf/zoo.cfg
Mode: standalone
[root@localhost bin]# ./zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /usr/local/software/zookeeper-3.4.8/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@localhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/software/zookeeper-3.4.8/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
[root@localhost bin]# 
复制代码

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多