Stephen
Stephen

Reputation: 95

Kafka Zookeeper non standard ports

I am seeing some undocumented ports being used by zookeeper within our kafka deployment (kafka_2.12-2.3.0). My understanding is that Kafka/Zookeeper uses 9092, 9093, 2181, 2888, 3888. We are seeing attempted connections in the 50000 port range. We have a need to configure firewalls as tightly as possible. Have i miss configured something or are their other non standard ports the Kafka/Zookeeper use?

Output from zookeeper

[2019-11-07 11:33:55,240] INFO Accepted socket connection from /192.168.0.52:52030 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2019-11-07 11:33:55,246] INFO Client attempting to establish new session at /192.168.0.52:52030 (org.apache.zookeeper.server.ZooKeeperServer)
[2019-11-07 11:33:55,250] INFO Established session 0x3004c34f9640003 with negotiated timeout 30000 for client /192.168.0.52:52030 (org.apache.zookeeper.server.ZooKeeperServer)
[2019-11-07 11:33:55,765] INFO Closed socket connection for client /192.168.0.52:52030 which had sessionid 0x3004c34f9640003 (org.apache.zookeeper.server.NIOServerCnxn)
[2019-11-07 11:34:16,499] INFO Accepted socket connection from /192.168.0.52:52038 (org.apache.zookeeper.server.NIOServerCnxnFactory)

zookeeper.properites

# the port at which the clients will connect
clientPort=2181
# disable the per-ip limit on the number of connections since this is a non-production config
maxClientCnxns=0
server.1=192.168.0.52:2888:3888
server.2=192.168.0.53:2888:3888
server.3=192.168.0.54:2888:3888

server.properites

############################# Socket Server Settings #############################

# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
#   FORMAT:
#     listeners = listener_name://host_name:port
#   EXAMPLE:
#     listeners = PLAINTEXT://your.host.name:9092
listeners=PLAINTEXT://192.168.0.52:9092

# Hostname and port the broker will advertise to producers and consumers. If not set,
# it uses the value for "listeners" if configured.  Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName().
advertised.listeners=PLAINTEXT://192.168.0.52:9092

Upvotes: 1

Views: 1211

Answers (1)

Mickael Maison
Mickael Maison

Reputation: 26885

What you are seeing in the logs is the socket (host and port) of the remote client connecting to Zookeeper.

You configured Zookeeper to listen on port 2888, but a client connecting to Zookeeper can use any of its (client) ports.

For example, in:

Accepted socket connection from /192.168.0.52:52038

It means that something (probably Kafka or Zookeeper) from 192.168.0.52:52038 connected to Zookeeper.

Client                      Zookeeper
192.168.0.52:52038   ---->  192.168.0.52:2888

Upvotes: 1

Related Questions