KafkaHealthcheck
KafkaHealthcheck registers the broker it runs on with Zookeeper (which in turn makes the broker visible to other brokers that together can form a Kafka cluster).
| Name | Description |
|---|---|
|
Creating KafkaHealthcheck Instance
KafkaHealthcheck takes the following when created:
KafkaHealthcheck initializes the internal registries and counters.
Starting Up — startup Method
startup
startup requests ZkUtils to subscribeStateChanges with sessionExpireListener.
In the end, startup registers the broker with Zookeeper.
|
Note
|
startup is used exclusively when KafkaServer starts up.
|
Registering Broker in Zookeeper — register Method
register(): Unit
register reads com.sun.management.jmxremote.port System property or defaults to -1.
For every EndPoint with no host assigned (in advertisedEndpoints), register assigns the fully-qualified domain name of the local host.
register then finds the first EndPoint with PLAINTEXT security protocol or creates an empty EndPoint.
|
Tip
|
Define EndPoint with PLAINTEXT security protocol for older clients to connect.
|
In the end, register requests ZkUtils to registerBrokerInZk for brokerId, the host and port of the PLAINTEXT endpoint, the updated endpoints, the JMX port, the optional rack and protocol version.
|
Note
|
register makes a broker visible for other brokers to form a Kafka cluster.
|
|
Note
|
register is used when KafkaHealthcheck starts up and handles a new session.
|