目录
前言:
zookeeper动态扩/缩容的reconfig命令旨在不需要重启zookeeper中任何一个节点的情况下,对整个zookeeper集群进行动态扩/缩容。
zookeeper客户端支持的命令:
[zk: localhost:2181(CONNECTED) 5] help
ZooKeeper -server host:port -client-configuration properties-file cmd args
addWatch [-m mode] path # optional mode is one of [PERSISTENT, PERSISTENT_RECURSIVE] - default is PERSISTENT_RECURSIVE
addauth scheme auth
close
# 查看配置
config [-c] [-w] [-s]
connect host:port
create [-s] [-e] [-c] [-t ttl] path [data] [acl]
delete [-v version] path
deleteall path [-b batch size]
delquota [-n|-b|-N|-B] path
get [-s] [-w] path
getAcl [-s] path
getAllChildrenNumber path
getEphemerals path
history
listquota path
ls [-s] [-w] [-R] path
printwatches on|off
quit
# 动态配置
reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*]
redo cmdno
removewatches path [-c|-d|-a] [-l]
set [-s] [-v version] path data
setAcl [-s] [-v version] [-R] path acl
setquota -n|-b|-N|-B val path
stat [-w] path
sync path
version
whoami
在实际验证中发现一些细节问题,先记录如下:
1、如果整个zk集群只有一个zk节点(即serverId只有它本身),这时默认运行的是单机模式,如果需要运行在集群模式下,需要加入standaloneEnabled=false的配置。
2、使用zkCli客户端提供的reconfig命令,需要修改/zookeper/config节点,普通账号对该节点上的数据只有ACL中的查看权限,有如下两种方法可以解决:
①关闭ACL,配置文件加入 skipACL=yes
②生成超级管理员账号:<

本文详细介绍了如何在Zookeeper中启动、扩容、缩容以及重新配置集群节点,包括reconfig命令的使用、解决单节点模式、配置权限问题和注意事项等。
&spm=1001.2101.3001.5002&articleId=134660586&d=1&t=3&u=6c66bdd55f9448409727eaf3df07f1e4)
921

被折叠的 条评论
为什么被折叠?



