Kafka zookeeper keep on showing info Message 'Accepted socket connection from /10.xxx.xxx.xxx'
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Apache Kafka utilizes Apache ZooKeeper to manage its cluster coordination and metadata storage. When running a Kafka server, administrators or developers may frequently notice log entries from ZooKeeper stating “Accepted socket connection from /10.xxx.xxx.xxx”. This message indicates a normal operational behavior where ZooKeeper has accepted a new network connection from a Kafka broker or another client.
Understanding ZooKeeper in Kafka
Apache ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications like Kafka.
ZooKeeper itself is a distributed application that offers a simple and robust interface. In Kafka, ZooKeeper is used for managing the state of the Kafka cluster. It keeps track of status of nodes in the Kafka cluster and Kafka topics configuration, elects Kafka broker leaders for partitions, and so on.
Why Does "Accepted socket connection from /10.xxx.xxx.xxx" Appear?
The message "Accepted socket connection from /10.xxx.xxx.xxx" which appears in ZooKeeper logs, signifies that ZooKeeper's server component has established a socket connection with a Kafka broker for communication purposes. The IP address following “from” signifies the origin of the connecting client - in the context of Kafka, this is typically one of the Kafka brokers in the cluster.
Here's what happens during this interaction:
- Kafka Broker Startup: When a Kafka broker starts up, it needs to register itself to ZooKeeper. It does this to let the cluster know it's available and ready to serve requests.
- Zookeeper Accepts Connection: ZooKeeper will listen to incoming connections on a predefined port. When a broker connects, ZooKeeper will log this as an accepted socket connection.
- Continuous Communication: Once connected, the broker and ZooKeeper will engage in continuous communication. This communication involves periodic heartbeats sent by the broker to ZooKeeper, meant to signal that it's still live and functioning correctly.
Decoding the IP Address and Connection Dynamics
The IP address /10.xxx.xxx.xxx is a placeholder for the actual IP address of the server making the connection. In Internet Protocol version 4 (IPv4), this address format is used for private networks.
Practical Example and Use
Consider a Kafka cluster with three brokers and a single ZooKeeper service:
- Broker1: 10.10.1.1
- Broker2: 10.10.1.2
- Broker3: 10.10.1.3
If you are monitoring your ZooKeeper logs and you see:
Each line indicates that all three brokers have successfully connected to ZooKeeper and can participate in cluster activities.
Summary Table of Key Points
| Key Point | Description |
| Purpose of ZooKeeper in Kafka | Maintain cluster state, configuration and leader election. |
| Instance of Log Message | "Accepted socket connection from /10.xxx.xxx.xxx" |
| Significance | Indicates a successful connection from a Kafka broker to ZooKeeper. |
| Process | Broker sends a connection request which ZooKeeper accepts; continuous communication follows. |
| Monitoring & Debugging | Used by administrators to verify network connections and troubleshoot cluster issues. |
Conclusion
Logs from ZooKeeper, including messages about accepted socket connections, are vital for monitoring the health and connectivity of the Kafka cluster. These logs help administrators in assuring operational status and also play a crucial role in diagnostics and cluster management.
From a developmental and operational perspective, understanding these log messages and their implications can be crucial for maintaining the reliability and efficiency of Kafka-powered applications. It’s a key aspect of Kafka’s operation that brokers remain effectively connected to ZooKeeper to ensure smooth data transactions and cluster coordination.
Related reading
- KafkaAvroDeserializer does not return SpecificRecord but returns GenericRecord
- KafkaAvroSerializer for serializing Avro without schema.registry.url
- Kafkacat how to delete a topic or all its messages?
- Kafkacat Produce message from a file with headers
- KafkaConsumer Java API subscribe() vs assign()
- kafka.consumer.SimpleConsumer Reconnect due to socket error java.nio.channels.ClosedChannelException
- kafka.errors.KafkaTimeoutError KafkaTimeoutError Failed to update metadata after 60.0 secs
- Kafka.JS refuses to connect <<[BrokerPool] Failed to connect to seed broker, trying another broker from the list>>

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.