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那保持一致

1.2.6 大数据2.x 集群安装系列-- zookeeper分布式集群部署_第1张图片

启动服务

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

你可能感兴趣的:(大数据,zookeeper)