189 8069 5689

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

成都创新互联致力于互联网网站建设与网站营销,提供成都做网站、网站设计、网站开发、seo优化、网站排名、互联网营销、小程序设计、公众号商城、等建站开发,成都创新互联网站建设策划专家,为不同类型的客户提供良好的互联网应用定制解决方案,帮助客户在新的全球化互联网环境中保持优势。

客户端有相同版本的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]

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


名称栏目:ZooKeeperInstall-创新互联
当前路径:http://jkwzsj.com/article/djsioh.html

其他资讯