btlqql opened a new pull request, #10628: URL: https://github.com/apache/rocketmq/pull/10628
### Which Issue(s) This PR Fixes - Fixes #9698 ### Brief Description #### Problem RocketMQ distributions do not provide a health-check command with reliable process exit codes. Container users currently have to install tools such as nc or nmap and can only test whether a port is open, or build a producer/consumer probe that creates traffic and resources. #### Root Cause The existing mqadmin brokerStatus command is designed for interactive diagnostics: it prints runtime data, does not validate a cluster as a whole, and MQAdminStartup catches command failures without exposing a health-specific exit-code contract. There is also no NameServer-only probe for an empty bootstrap cluster. #### Changes - add mqadmin clusterHealth for direct-broker, NameServer-only, selected-cluster, and all-cluster checks - discover brokers through NameServer and probe broker runtime RPCs concurrently with a bounded overall deadline - support master-only checks and an optional brokerActive requirement - provide deterministic text and JSON reports with per-broker latency, version, status, and failure details - add mqhealthcheck and mqhealthcheck.cmd distribution launchers with stable exit codes: 0 healthy, 1 unhealthy, 2 usage or execution error - keep checks read-only: no topics, messages, producers, or consumers are created - add focused coverage for discovery failures, malformed responses, direct checks, filtering, master/slave selection, active-state validation, deadlines, formatting, lifecycle cleanup, and exit codes #### Impact Container images and orchestration systems can use the bundled command directly in Docker HEALTHCHECK or readiness scripts. Operators can distinguish a live RPC service from an open TCP port, inspect machine-readable details, and check an empty NameServer independently from broker availability. Existing mqadmin commands and behavior are unchanged. Example uses: - mqhealthcheck -n 127.0.0.1:9876 -s - mqhealthcheck -b 127.0.0.1:10911 - mqhealthcheck -n 127.0.0.1:9876 -c DefaultCluster -m -a -f json ### How Did You Test This Change? JDK 8 (Temurin 8.0.482): - focused health-check tests: 54 tests, 0 failures, 0 errors, 0 skipped - full rocketmq-tools suite: 201 tests, 0 failures, 0 errors, 5 existing skips; BUILD SUCCESS - tools reactor package build: 7 modules; BUILD SUCCESS - Checkstyle: 0 violations Commands: mvn -pl tools test -Dtest=ClusterHealthRequestTest,ClusterHealthReportTest,ClusterHealthCheckerTest,ClusterHealthSubCommandTest,MQHealthCheckStartupTest -Dspotbugs.skip=true -Djacoco.skip=true mvn -pl tools test -Dspotbugs.skip=true -Djacoco.skip=true mvn -pl tools -am package -DskipTests -Dspotbugs.skip=true -Djacoco.skip=true -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
