Skip to content

Zookeeper pods unable to see each other #28

@cdelpinogeo

Description

@cdelpinogeo

I am deploying the Zookeeper statefulset manifest and I see the following in the logs from the pods:

	at java.net.InetAddress.getByName(InetAddress.java:1076)
	at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.recreateSocketAddresses(QuorumPeer.java:166)
	at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:595)
	at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:614)
	at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:843)
	at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:913)
2017-06-16 02:29:03,164 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 60000
2017-06-16 02:30:03,165 [myid:1] - WARN  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@588] - Cannot open channel to 2 at election address api-pers-zoo-1.capi.svc.cluster.local:3888
java.net.UnknownHostException: api-pers-zoo-1.capi.svc.cluster.local
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:562)
	at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:614)
	at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:843)
	at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:913)
2017-06-16 02:30:03,169 [myid:1] - WARN  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer$QuorumServer@173] - Failed to resolve address: api-pers-zoo-1.capi.svc.cluster.local
java.net.UnknownHostException: api-pers-zoo-1.capi.svc.cluster.local: Name does not resolve
	at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
	at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
	at java.net.InetAddress.getAllByName(InetAddress.java:1192)
	at java.net.InetAddress.getAllByName(InetAddress.java:1126)
	at java.net.InetAddress.getByName(InetAddress.java:1076)
	at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.recreateSocketAddresses(QuorumPeer.java:166)
	at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:595)
	at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:614)
	at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:843)
	at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:913)

I've updated the command in the statefulset manifest to provide the complete name of each zookeeper pod:

apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: api-pers-zoo
  namespace: capi
spec:
  serviceName: "api-pers-zoo"
  replicas: 5
  template:
    metadata:
      labels:
        app: api-pers-zookeeper
    spec:
      terminationGracePeriodSeconds: 10
      containers:
        - name: api-pers-zookeeper
          image: solsson/zookeeper-statefulset
          env:
            - name: ZOO_SERVERS
              value: server.1=api-pers-zoo-0.capi.svc.cluster.local:2888:3888:participant server.2=api-pers-zoo-1.capi.svc.cluster.local:2888:3888:participant server.3=api-pers-zoo-2.capi.svc.cluster.local:2888:3888:participant server.4=api-pers-zoo-3.capi.svc.cluster.local:2888:3888:participant server.5=api-pers-zoo-4.capi.svc.cluster.local:2888:3888:participant
          ports:
            - containerPort: 2181
              name: client
            - containerPort: 2888
              name: peer
            - containerPort: 3888
              name: leader-election
          volumeMounts:
            - name: datadir
              mountPath: /data
            # There's defaults in this folder, such as logging config
            #- name: conf
            #  mountPath: /conf
      volumes:
        #- name: conf
        #  emptyDir: {}
        - name: datadir
          emptyDir: {}

Services defined as follow:

apiVersion: v1
kind: Service
metadata:
  name: api-pers-zoo
  namespace: capi
spec:
  ports:
  - port: 2888
    name: peer
  - port: 3888
    name: leader-election
  clusterIP: None
  selector:
    app: api-pers-zookeeper

and

# the headless service is for PetSet DNS, this one is for clients
apiVersion: v1
kind: Service
metadata:
  name: api-pers-zookeeper
  namespace: capi
spec:
  ports:
  - port: 2181
    name: client
  selector:
    app: api-pers-zookeeper

Any ideas where I am going wrong? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions