linux 安装zookeeper

提前准备:

虚拟机一台、zookeeper安装包一份

1、连接并登录虚拟机.

2、进入 /usr/local/ 目录下

lrwxrwxrwx.   1 root root    7 Jan 10  2019 bin -> usr/bin
dr-xr-xr-x.   4 root root 4096 Jan 10  2019 boot
drwxr-xr-x   19 root root 3180 Apr  7 09:46 dev
drwxr-xr-x. 133 root root 8192 Apr  7 17:37 etc
drwxr-xr-x.   6 root root  105 Jan 10  2019 home
lrwxrwxrwx.   1 root root    7 Jan 10  2019 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 Jan 10  2019 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 Nov  5  2016 media
drwxr-xr-x.   2 root root    6 Nov  5  2016 mnt
drwxr-xr-x.   3 root root   16 Jan 10  2019 opt
dr-xr-xr-x  212 root root    0 Apr  7 09:45 proc
dr-xr-x---.   6 root root  266 Apr  7 17:37 root
drwxr-xr-x   36 root root 1140 Apr  7 16:07 run
lrwxrwxrwx.   1 root root    8 Jan 10  2019 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 Nov  5  2016 srv
dr-xr-xr-x   13 root root    0 Apr  7 09:45 sys
drwxrwxrwt.  16 root root 4096 Apr  7 18:25 tmp
drwxr-xr-x.  13 root root  155 Jan 10  2019 usr
drwxr-xr-x.  20 root root  282 Apr  7 09:45 var
[root@localhost /]# cd usr/local/

2、在 /usr/local/ 目录下创建 zookeeper 目录

[root@localhost local]# mkdir zookeeper

3、将安装包放置 zookeeper 目录下

drwxr-xr-x. 2 root root   6 Nov  5  2016 bin
drwxr-xr-x. 2 root root   6 Nov  5  2016 etc
drwxr-xr-x. 2 root root   6 Nov  5  2016 games
drwxr-xr-x. 2 root root   6 Nov  5  2016 include
drwxr-xr-x. 2 root root   6 Nov  5  2016 lib
drwxr-xr-x. 2 root root   6 Nov  5  2016 lib64
drwxr-xr-x. 2 root root   6 Nov  5  2016 libexec
drwxr-xr-x. 2 root root   6 Nov  5  2016 sbin
drwxr-xr-x. 5 root root  49 Jan 10  2019 share
drwxr-xr-x. 2 root root   6 Nov  5  2016 src
drwxr-xr-x  5 root root 115 Apr  7 13:51 zookeeper
[root@localhost local]# 

4、解压zookeeper安装包

[root@localhost zookeeper]# tar -zxvf zookeeper-3.4.5
drwxr-xr-x 10  501 games     4096 Nov  5  2012 zookeeper-3.4.5
-rw-r--r--  1 root root  16402010 Apr  7 11:09 zookeeper-3.4.5.tar.gz

5、进入zookeeper-3.4.5 目录下

drwxr-xr-x  2 501 games     170 Apr  7 11:26 bin
-rw-r--r--  1 501 games   75988 Oct  1  2012 build.xml
-rw-r--r--  1 501 games   70223 Oct  1  2012 CHANGES.txt
drwxr-xr-x  2 501 games     112 Apr  7 16:02 conf
drwxr-xr-x 10 501 games     130 Apr  7 11:13 contrib
drwxr-xr-x  2 501 games    4096 Apr  7 11:13 dist-maven
drwxr-xr-x  6 501 games    4096 Apr  7 11:13 docs
-rw-r--r--  1 501 games    1953 Oct  1  2012 ivysettings.xml
-rw-r--r--  1 501 games    3120 Oct  1  2012 ivy.xml
drwxr-xr-x  4 501 games     235 Apr  7 11:13 lib
-rw-r--r--  1 501 games   11358 Oct  1  2012 LICENSE.txt
-rw-r--r--  1 501 games     170 Oct  1  2012 NOTICE.txt
-rw-r--r--  1 501 games    1770 Oct  1  2012 README_packaging.txt
-rw-r--r--  1 501 games    1585 Oct  1  2012 README.txt
drwxr-xr-x  5 501 games      47 Apr  7 11:13 recipes
drwxr-xr-x  8 501 games     154 Apr  7 11:13 src
-rw-r--r--  1 501 games 1315806 Nov  5  2012 zookeeper-3.4.5.jar
-rw-r--r--  1 501 games     833 Nov  5  2012 zookeeper-3.4.5.jar.asc
-rw-r--r--  1 501 games      33 Nov  5  2012 zookeeper-3.4.5.jar.md5
-rw-r--r--  1 501 games      41 Nov  5  2012 zookeeper-3.4.5.jar.sha1

6、进入 conf 目录复制一份 zoo_sample.cfg 并改名为:zoo.cfg

-rw-r--r-- 1  501 games  535 Oct  1  2012 configuration.xsl
-rw-r--r-- 1  501 games 2161 Oct  1  2012 log4j.properties
-rw-r--r-- 1 root root   850 Apr  7 13:50 zoo.cfg
-rw-r--r-- 1  501 games  808 Oct  1  2012 zoo_sample.cfg

7、编辑 zoo.cfg 文件

[root@localhost conf]# vi zoo.cfg

8、增加两个配置

# 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
dataLogDir=/usr/local/zookeeper/log
# 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

该配置目录配置为 安装的 zookeeper 目录

 9、配置 zookeeper 环境

[root@localhost bin]# export ZOOKEEPER_INSTALL=/usr/local/zookeeper/zookeeper-3.4.5/
[root@localhost bin]# export PATH=$PATH:$ZOOKEEPER_INSTALL/bin

10、进入zookeeper 的bin 目录下

[root@localhost bin]# pwd
/usr/local/zookeeper/zookeeper-3.4.5/bin
[root@localhost bin]# ll
total 76
-rwxr-xr-x 1  501 games   238 Oct  1  2012 README.txt
-rwxr-xr-x 1  501 games  1909 Oct  1  2012 zkCleanup.sh
-rwxr-xr-x 1  501 games  1049 Oct  1  2012 zkCli.cmd
-rwxr-xr-x 1  501 games  1512 Oct  1  2012 zkCli.sh
-rwxr-xr-x 1  501 games  1333 Oct  1  2012 zkEnv.cmd
-rwxr-xr-x 1  501 games  2599 Oct  1  2012 zkEnv.sh
-rwxr-xr-x 1  501 games  1084 Oct  1  2012 zkServer.cmd
-rwxr-xr-x 1  501 games  5467 Oct  1  2012 zkServer.sh
-rw-r--r-- 1 root root  40363 Apr  7 17:46 zookeeper.out
[root@localhost bin]# 

11、启动 zookeeper   ./zkServer.sh start

[root@localhost bin]# ./zkServer.sh start

启动成功如下:

ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

13、查看启动情况  ./zkServer.sh status

[root@localhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.13/bin/../conf/zoo.cfg
Mode: standalone

12、启动zookeeper 客户端  ./zkCli.sh start

[root@localhost bin]# ./zkCli.sh start

启动成功,安装完成

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值