快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

ZooKeeperInstall

Tar -zxvf zookeeper-3.4.10.tar.gz
[root@hmaster local]# rm -rf zookeeper-3.4.10.tar.gz
远程传输zookeeper-3.4.10到其他节点
[root@hmaster local]# scp -r /usr/local/zookeeper-3.4.10 root@hslave1:/usr/local/
[root@hmaster local]# ls
bin etc games hadoop hive include java lib lib64 libexec python3Dir sbin share src zookeeper-3.4.10
[root@hmaster conf]# ls
configuration.xsl log4j.properties zoo_sample.cfg
[root@hmaster conf]# cp zoo_sample.cfg zoo.cfg
[root@hmaster conf]# ls
configuration.xsl log4j.properties zoo.cfg zoo_sample.cfg
编辑配置文件
[root@hmaster conf]# vim zoo.cfg
#第一个端口号2888 是Leader与follower之间通讯的端口;3888是选举使用的端口号
#autopurge.purgeInterval=1
server.0=172.26.19.40:2888:3888
server.1=172.26.19.41:2888:3888
server.2=172.26.19.42:2888:3888
根据zoo.cfg 文件中dataDir=/tmp/zookeeper 创建相应目录,配置myid文件,使得集群映射
[root@hslave1 conf]# cd /tmp
[root@hslave1 tmp]# ls
hsperfdata_root systemd-private-d38862e2d5524a42994bdd9ddd858f50-chronyd.service-nIGJPI
[root@hslave1 tmp]# mkdir zookeeper
[root@hslave1 tmp]# vim myid
[root@hslave1 tmp]# more myid
1
[root@hslave1 tmp]#
每台机器输入对IP的信息server.0=172.26.19.40:2888:3888;应该输入0
[root@hmaster bin]# ./zkServer.sh status
[root@hmaster bin]# ./zkServer.sh start
[root@hmaster bin]# ./zkServer.sh stop
[root@hmaster bin]# jps
21690 Jps
21550 QuorumPeerMain
[root@hmaster bin]# kill -9 18976
查看zookeeper日志文件
[root@hmaster bin]# more zookeeper.out

创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站设计、做网站、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的祁县网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

客户端有相同版本的zookeeper-3.4.10包文件(从远程zookeeper节点拷贝而来)
客户端登录
[root@hslave3 bin]# ./zkCli.sh -server hmaster:2181
[zk: hmaster:2181(CONNECTED) 0] help
ZooKeeper -server host:port cmd args
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: hmaster:2181(CONNECTED) 1] ls /
一致,有头,数据树
[zk: hslave1:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: hslave1:2181(CONNECTED) 1] create /app app_content
Created /app
[zk: hslave1:2181(CONNECTED) 2] ls /
[app, zookeeper]
[zk: hslave1:2181(CONNECTED) 3] get /app
app_content
cZxid = 0x200000002
ctime = Mon Dec 10 21:43:19 EST 2018
mZxid = 0x200000002
mtime = Mon Dec 10 21:43:19 EST 2018
pZxid = 0x200000002
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 11
numChildren = 0
[zk: hslave1:2181(CONNECTED) 4] set /app appcontent11
cZxid = 0x200000002
ctime = Mon Dec 10 21:43:19 EST 2018
mZxid = 0x200000003
mtime = Mon Dec 10 21:45:05 EST 2018
pZxid = 0x200000002
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 12
numChildren = 0
[zk: hslave1:2181(CONNECTED) 5] get /app
appcontent11
cZxid = 0x200000002
ctime = Mon Dec 10 21:43:19 EST 2018
mZxid = 0x200000003
mtime = Mon Dec 10 21:45:05 EST 2018
pZxid = 0x200000002
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 12
numChildren = 0
[zk: hslave1:2181(CONNECTED) 6] delete /app
[zk: hslave1:2181(CONNECTED) 7] ls /
[zookeeper]


名称栏目:ZooKeeperInstall
标题路径:http://6mz.cn/article/gddhpd.html

其他资讯