From 11e9cc35fab809498217b4da2cc9443db523ba87 Mon Sep 17 00:00:00 2001 From: horizonzy Date: Thu, 25 Jan 2024 11:48:00 +0800 Subject: [PATCH] Check the server status when execute ruok command --- .../org/apache/zookeeper/server/command/RuokCommand.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/command/RuokCommand.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/command/RuokCommand.java index 02bcc803cc4..17463e3a0a0 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/command/RuokCommand.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/command/RuokCommand.java @@ -29,7 +29,11 @@ public RuokCommand(PrintWriter pw, ServerCnxn serverCnxn) { @Override public void commandRun() { - pw.print("imok"); + if (!isZKServerRunning()) { + pw.println(ZK_NOT_SERVING); + } else { + pw.print("imok"); + } } }