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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章