You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by sy...@apache.org on 2022/05/17 08:36:31 UTC
[zookeeper] 01/03: ZOOKEEPER-3876: zkServer.sh status command fails when IPV6 is configured
This is an automated email from the ASF dual-hosted git repository.
symat pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
commit fd9219c4f5d4a0e9423cc2fd3d03c86a2edfa6d6
Author: Mohammad Arshad <ar...@apache.org>
AuthorDate: Wed Jul 29 12:31:40 2020 +0200
ZOOKEEPER-3876: zkServer.sh status command fails when IPV6 is configured
Modified host and IP parsing logic for IPV6
Author: Mohammad Arshad <ar...@apache.org>
Reviewers: Enrico Olivelli <eo...@apache.org>
Closes #1395 from arshadmohammad/ZOOKEEPER-3876
(cherry picked from commit c9f15213663fc9b86809adcbc27a4dbe1232c31a)
Signed-off-by: Enrico Olivelli <eo...@apache.org>
(cherry picked from commit f6b7b1b35be13a2bb35f44f58773ba87f5b40b50)
---
bin/zkServer.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/bin/zkServer.sh b/bin/zkServer.sh
index 1a5056c09..816a12de5 100755
--- a/bin/zkServer.sh
+++ b/bin/zkServer.sh
@@ -249,7 +249,12 @@ status)
echo "Client port not found in the server configs"
else
if [[ "$clientPortAndAddress" =~ ^.*:[0-9]+ ]] ; then
- clientPortAddress=`echo "$clientPortAndAddress" | sed -e 's/:.*//'`
+ if [[ "$clientPortAndAddress" =~ \[.*\]:[0-9]+ ]] ; then
+ # Extracts address from address:port for example extracts 127::1 from "[127::1]:2181"
+ clientPortAddress=`echo "$clientPortAndAddress" | sed -e 's|\[||' | sed -e 's|\]:.*||'`
+ else
+ clientPortAddress=`echo "$clientPortAndAddress" | sed -e 's/:.*//'`
+ fi
fi
clientPort=`echo "$clientPortAndAddress" | sed -e 's/.*://'`
fi