zookeeper3.4.5安装

进入下载链接:http://archive.apache.org/dist/zookeeper/ , 选择.tar.gz后缀的文件以及合适的版本下载

建立一个文件下 上传安装包

[root@zookeeper1 ~]# mkdir /usr/local/software

2、进入软件包目录解压安装包

[root@taotao ~]# cd /usr/local/software
[root@zookeeper1 software]# tar -zxvf zookeeper-3.4.5.tar.gz -C /usr/local/

3、进入解压后的目录查看

[root@taotao software]# cd /usr/local/zookeeper-3.4.5/
[root@taotao zookeeper-3.4.5]# ll
总用量 1512
drwxr-xr-x.  2 501 games    4096 11月 10 19:34 bin
-rw-r--r--.  1 501 games   75988 10月  1 2012 build.xml
-rw-r--r--.  1 501 games   70223 10月  1 2012 CHANGES.txt
drwxr-xr-x.  2 501 games    4096 11月 10 19:34 conf
drwxr-xr-x. 10 501 games    4096 11月 10 19:34 contrib
drwxr-xr-x.  2 501 games    4096 11月 10 19:34 dist-maven
drwxr-xr-x.  6 501 games    4096 11月 10 19:34 docs
-rw-r--r--.  1 501 games    1953 10月  1 2012 ivysettings.xml
-rw-r--r--.  1 501 games    3120 10月  1 2012 ivy.xml
drwxr-xr-x.  4 501 games    4096 11月 10 19:34 lib
-rw-r--r--.  1 501 games   11358 10月  1 2012 LICENSE.txt
-rw-r--r--.  1 501 games     170 10月  1 2012 NOTICE.txt
-rw-r--r--.  1 501 games    1770 10月  1 2012 README_packaging.txt
-rw-r--r--.  1 501 games    1585 10月  1 2012 README.txt
drwxr-xr-x.  5 501 games    4096 11月 10 19:34 recipes
drwxr-xr-x.  8 501 games    4096 11月 10 19:34 src
-rw-r--r--.  1 501 games 1315806 11月  5 2012 zookeeper-3.4.5.jar
-rw-r--r--.  1 501 games     833 11月  5 2012 zookeeper-3.4.5.jar.asc
-rw-r--r--.  1 501 games      33 11月  5 2012 zookeeper-3.4.5.jar.md5
-rw-r--r--.  1 501 games      41 11月  5 2012 zookeeper-3.4.5.jar.sha1

4、启动之前先进行配置,在当前目录下创建一个data目录

[root@taotao zookeeper-3.4.5]# mkdir data
[root@taotao zookeeper-3.4.5]# ll
总用量 1516
drwxr-xr-x.  2  501 games    4096 11月 10 19:34 bin
-rw-r--r--.  1  501 games   75988 10月  1 2012 build.xml
-rw-r--r--.  1  501 games   70223 10月  1 2012 CHANGES.txt
drwxr-xr-x.  2  501 games    4096 11月 10 19:34 conf
drwxr-xr-x. 10  501 games    4096 11月 10 19:34 contrib
drwxr-xr-x.  2 root root     4096 11月 10 19:41 data
drwxr-xr-x.  2  501 games    4096 11月 10 19:34 dist-maven
drwxr-xr-x.  6  501 games    4096 11月 10 19:34 docs
-rw-r--r--.  1  501 games    1953 10月  1 2012 ivysettings.xml
-rw-r--r--.  1  501 games    3120 10月  1 2012 ivy.xml
drwxr-xr-x.  4  501 games    4096 11月 10 19:34 lib
-rw-r--r--.  1  501 games   11358 10月  1 2012 LICENSE.txt
-rw-r--r--.  1  501 games     170 10月  1 2012 NOTICE.txt
-rw-r--r--.  1  501 games    1770 10月  1 2012 README_packaging.txt
-rw-r--r--.  1  501 games    1585 10月  1 2012 README.txt
drwxr-xr-x.  5  501 games    4096 11月 10 19:34 recipes
drwxr-xr-x.  8  501 games    4096 11月 10 19:34 src
-rw-r--r--.  1  501 games 1315806 11月  5 2012 zookeeper-3.4.5.jar
-rw-r--r--.  1  501 games     833 11月  5 2012 zookeeper-3.4.5.jar.asc
-rw-r--r--.  1  501 games      33 11月  5 2012 zookeeper-3.4.5.jar.md5
-rw-r--r--.  1  501 games      41 11月  5 2012 zookeeper-3.4.5.jar.sha1
[root@taotao zookeeper-3.4.5]# 

5、进入到conf目录下,可以看到该目录下有个zoo_sample.cfg文件。

[root@taotao conf]# ll
总用量 12
-rw-r--r--. 1 501 games  535 10月  1 2012 configuration.xsl
-rw-r--r--. 1 501 games 2161 10月  1 2012 log4j.properties
-rw-r--r--. 1 501 games  808 10月  1 2012 zoo_sample.cfg
[root@taotao conf]# 

6、将zoo_sample.cfg文件改下名字,如下图

[root@taotao conf]# mv zoo_sample.cfg zoo.cfg
[root@taotao conf]# ll
总用量 12
-rw-r--r--. 1 501 games  535 10月  1 2012 configuration.xsl
-rw-r--r--. 1 501 games 2161 10月  1 2012 log4j.properties
-rw-r--r--. 1 501 games  808 10月  1 2012 zoo.cfg
[root@taotao conf]# 

7、修改zoo.cfg文件,命令是vi zoo.cfg,在打开的文件中修改"dataDir"的路径为我们上面创建的data的绝对路径。如下所示。

[root@taotao conf]# 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=/usr/local/zookeeper-3.4.5/data
# the port at which the clients will connect
clientPort=2181
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/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

按ESC退出编辑模式,然后按Shift+ZZ来保存并退出zoo.cfg

8、进入到bin目录下,使用命令./zkServer.sh start来启动zookeeper,启动完之后,我们可以使用./zkServer.sh status来查看启动状态

[root@taotao ~]# cd /usr/local/zookeeper-3.4.5/
[root@taotao zookeeper-3.4.5]# ls
bin          dist-maven       NOTICE.txt            zookeeper-3.4.5.jar.asc
build.xml    docs             README_packaging.txt  zookeeper-3.4.5.jar.md5
CHANGES.txt  ivysettings.xml  README.txt            zookeeper-3.4.5.jar.sha1
conf         ivy.xml          recipes
contrib      lib              src
data         LICENSE.txt      zookeeper-3.4.5.jar
[root@taotao zookeeper-3.4.5]# cd bin
[root@taotao bin]# ls
README.txt    zkCli.cmd  zkEnv.cmd  zkServer.cmd
zkCleanup.sh  zkCli.sh   zkEnv.sh   zkServer.sh
[root@taotao bin]# ./zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@taotao bin]# 

关闭zookeeper可以使用命令./zkServer.sh stop来关闭

如果出现端口无法访问的情况,请关闭防火墙,并且设置开机也不启动

[root@taotao bin]# service iptables stop
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]

设置开机不启动

[root@taotao bin]# chkconfig iptables off

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值