You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pulse only did generic TCP checks for all services, including Zookeeper. This adds a proper Zookeeper-aware checker using the four-letter word (FLW) ruok/imok protocol, and supports the standard Zookeeper ensemble connection string format.
Changes
checker/zookeeper.go
CheckZookeeperConnection(connectString, timeout) — parses a standard Zookeeper connection string (host1:2181,host2:2181,host3:2181[/chroot]) and returns nil if any node responds imok to ruok
Falls back gracefully: a plain host:port is treated as a single-node connection string
On total failure, reports all per-node errors for diagnostics
main.go
Dispatches to CheckZookeeperConnection when service == "zookeeper"; all other services continue using the generic TCP checker
config.yml
Zookeeper entries consolidated into ensemble connection string format:
@copilot
if we need remain the tcp network check? or just delete the old way
i want to know the best practce
The generic TCP CheckConnection is intentionally kept — it's still used for every other service (Redis, Kafka, Elasticsearch, etc.). For Zookeeper specifically, the ruok/imok check replaces it rather than running in addition to it, because:
ruok already implies TCP reachability — checkZookeeperNode does net.DialTimeout first, so a failed TCP connection is still caught and reported as an error.
More meaningful signal — a port can be open (TCP succeeds) while Zookeeper itself is in an error state; ruok/imok verifies the process is actually healthy, not just listening.
No redundancy needed — running a plain TCP check and a ruok check on the same address would just report the same failure twice with different messages.
One caveat: Zookeeper ≥ 3.5 requires ruok to be explicitly whitelisted (4lw.commands.whitelist=ruok in zoo.cfg). If your deployment restricts four-letter words, the Zookeeper-specific checker will fail even when the node is healthy. In that case, falling back to the plain TCP check in checker.go for that service is the right call.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pulse only did generic TCP checks for all services, including Zookeeper. This adds a proper Zookeeper-aware checker using the four-letter word (FLW)
ruok/imokprotocol, and supports the standard Zookeeper ensemble connection string format.Changes
checker/zookeeper.goCheckZookeeperConnection(connectString, timeout)— parses a standard Zookeeper connection string (host1:2181,host2:2181,host3:2181[/chroot]) and returnsnilif any node respondsimoktoruokhost:portis treated as a single-node connection stringmain.goCheckZookeeperConnectionwhenservice == "zookeeper"; all other services continue using the generic TCP checkerconfig.ymlchecker/zookeeper_test.go