搭建zookeeper集群时,配置文件为:

…………省略其他内容

server.1=192.168.244.128:2888:3888
server.2=192.168.244.129:2888:3888
server.3=192.168.244.130:2888:3888

各自主机的dataDir也都分别创建了 myid 文件。

在三台主机上分别启动 zkServer 都没有问题,但是查看status时,报错:Error contacting service. It is probably not running. 查看日志发现 Cannot open channel to 3 at election address xxx/24:xxxx …… No route to host 。

提示找不到目标主机的路径,怀疑是因为防火墙原因,造成目标主机不可达。

百度,发现解决方案,在三台主机上分别将另外两个地址加入防火墙白名单。

firewall-cmd --zone=trusted --add-source=192.168.244.129/24 --permanent

最后,重新reload

firewall-cmd --reload

再重启各zookeeper之后 正常。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐