1.2.6 大数据2.x 集群安装系列-- zookeeper分布式集群部署

版本zookeeper-3.4.5-cdh5.10.0

配置

conf/zoo.cfg

tickTime=2000 心跳时间单位

initLimit=10 10*2000 初始连接最长忍受心跳间隔

dataDir=/opt/modules/zookeeper-3.4.5-cdh5.10.0/zkData 文件夹

bigdata-pro01.kfk 域名

# 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=/opt/modules/zookeeper-3.4.5-cdh5.10.0/zkData
# 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

server.1=bigdata-pro01.kfk.com:2888:3888
server.2=bigdata-pro02.kfk.com:2888:3888
server.3=bigdata-pro03.kfk.com:2888:3888

每台设置myid 跟server那保持一致

在这里插入图片描述

启动服务

ZooKeeperMain
QuorumPeerMain

[kfk@bigdata-pro01 bin]$ ./zk
zkCleanup.sh            zkEnv.cmd               zkServer-initialize.sh
zkCli.cmd               zkEnv.sh                zkServer.sh
zkCli.sh                zkServer.cmd            
[kfk@bigdata-pro01 bin]$ ./zkServer.sh start
JMX enabled by default
Using config: /opt/modules/zookeeper-3.4.5-cdh5.10.0/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[kfk@bigdata-pro01 bin]$ jps
10448 JobHistoryServer
16192 NodeManager
15569 DataNode
15721 SecondaryNameNode
23337 QuorumPeerMain
15899 ResourceManager
15439 NameNode
23359 Jps

连接

[kfk@bigdata-pro01 bin]$ ./zkCli.sh 

命令

stat path [watch]
        set path data [version]
        ls path [watch]
        delquota [-n|-b] path
        ls2 path [watch]
        setAcl path acl
        setquota -n|-b val path
        history 
        redo cmdno
        printwatches on|off
        delete path [version]
        sync path
        listquota path
        rmr path
        get path [watch]
        create [-s] [-e] path data acl
        addauth scheme auth
        quit 
        getAcl path
        close 
        connect host:port

[zk: localhost:2181(CONNECTED) 6] create /test t1
Created /test
[zk: localhost:2181(CONNECTED) 7] ls
[zk: localhost:2181(CONNECTED) 8] ls /
[storm, brokers, zookeeper, test, yarn-leader-election, hadoop-ha, isr_change_notification, admin, kfk, controller_epoch, rmstore, consumers, config, hbase]
[zk: localhost:2181(CONNECTED) 9] get /test
t1
cZxid = 0xdd00000002
ctime = Sun Feb 23 22:37:30 EST 2020
mZxid = 0xdd00000002
mtime = Sun Feb 23 22:37:30 EST 2020
pZxid = 0xdd00000002
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 2
numChildren = 0

查看主从节点

[kfk@bigdata-pro02 bin]$ ./zkServer.sh status
JMX enabled by default
Using config: /opt/modules/zookeeper-3.4.5-cdh5.10.0/bin/../conf/zoo.cfg
Mode: leader
[kfk@bigdata-pro02 bin]$ 

[kfk@bigdata-pro03 bin]$ ./zkServer.sh status
JMX enabled by default
Using config: /opt/modules/zookeeper-3.4.5-cdh5.10.0/bin/../conf/zoo.cfg
Mode: follower
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值