k8s上部署zookeeper集群报错java.net.BindException: Cannot assign requested address (Bind failed)

2021-12-07 16:34:01 浏览数 (1)

部署

1.配置3个POD部署zookeeper节点, 2.分别使用clusterIP暴露2888,3888端口 3.配置环境变量 ZOO_SERVERS=“server.1=zookeeper-cluster-1.test.svc.cluster.local:2888:3888;2181 server.2=zookeeper-cluster-2.test.svc.cluster.local:2888:3888;2181 server.3=zookeeper-cluster-3.test.svc.cluster.local:2888:3888;2181” MY_ZOO_ID=1

报错

2021-11-11 00:46:39,727 [myid:1] - ERROR [ListenerHandler-zookeeper-cluster-1.test.svc.cluster.local/172.24.166.69:3888:QuorumCnxManager

Listener

ListenerHandler@1094] - Exception while listening java.net.BindException: Cannot assign requested address (Bind failed)

原因

因为3888端口通过K8S服务暴露,需要添加配置项quorumListenOnAllIPs=true以保证扫描所有网卡

解决

通过环境变量添加配置项 ZOO_CFG_EXTRA=“quorumListenOnAllIPs=true”

0 人点赞