在Zookeeper中使用reconfig命令删除服务器时导致MarshallingError的原因

问题描述

我正在尝试使用reconfig命令删除五台服务器之一,但得到KeeperErrorCode = MarshallingError

这是群集信息和错误消息:

[zk: [ClientIP](CONNECTED) 2] get /zookeeper/config
server.0=[ip0]:port1:port2:participant
server.1=[ip1]:port1:port2:participant
server.2=[ip2]:port1:port2:participant
server.3=[ip3]:port1:port2:participant
server.4=[ip4]:port1:port2:participant
version=200000000
[zk: [ClientIP](CONNECTED) 3] reconfig -remove server.2=[ip2]:port1:port2:participant
KeeperErrorCode = MarshallingError

我不确定为什么会发生此错误以及如何解决。如何删除其中一台服务器?

解决方法

您有2个问题。

  1. 您无需在删除时指定服务器IP:

    重新配置[-s] [-v版本] [[-文件路径] | [-成员serverID = host:port1:port2; port3 [,...] ]] | [-add serverId = host:port1:port2; port3 [,...]] [-删除serverId [,...] *]

  2. 仅设置服务器ID

好的命令示例:

[shahar.l]#  /opt/kafka/bin/zookeeper-shell.sh localhost:2181 reconfig -remove 5
Connecting to localhost:2181

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
Committed new configuration:
server.4=IP:2888:3888:participant;0.0.0.0:2181
server.6=IP:2888:3888:participant;0.0.0.0:2181
server.7=IP:2888:3888:participant;0.0.0.0:2181
version=1700007e9d

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...