From 42a2d72401b9efb7b5bd3628de949877b928fce8 Mon Sep 17 00:00:00 2001 From: liguohao <948193394@qq.com> Date: Mon, 18 Apr 2022 22:11:40 +0800 Subject: [PATCH] feat: zookeeper client support kerberos --- rdsn | 2 +- scripts/clear_zk.sh | 2 +- scripts/start_zk.sh | 31 +++++++++++++++++++++---------- scripts/stop_zk.sh | 2 +- src/server/CMakeLists.txt | 2 +- src/server/test/CMakeLists.txt | 2 +- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/rdsn b/rdsn index 7f02509f2c..6cf41ac5c7 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit 7f02509f2cc6d66b6d27b22592607fbcbfc01ce7 +Subproject commit 6cf41ac5c7d293676fb6cc3657c217c6dc524c09 diff --git a/scripts/clear_zk.sh b/scripts/clear_zk.sh index aa02ef7948..a31a90e129 100755 --- a/scripts/clear_zk.sh +++ b/scripts/clear_zk.sh @@ -27,7 +27,7 @@ fi cd $INSTALL_DIR -ZOOKEEPER_HOME=`pwd`/zookeeper-3.4.6 +ZOOKEEPER_HOME=`pwd`/apache-zookeeper-3.7.0-bin if [ -d "$ZOOKEEPER_HOME" ] then diff --git a/scripts/start_zk.sh b/scripts/start_zk.sh index 385b3fb626..f8dcf54e28 100755 --- a/scripts/start_zk.sh +++ b/scripts/start_zk.sh @@ -40,32 +40,43 @@ fi cd "$INSTALL_DIR" || exit -if [ ! -f zookeeper-3.4.6.tar.gz ]; then +ZOOKEEPER_ROOT=apache-zookeeper-3.7.0-bin +ZOOKEEPER_TAR_NAME=${ZOOKEEPER_ROOT}.tar.gz +ZOOKEEPER_TAR_MD5_VALUE="8ffa97e7e6b0b2cf1d022e5156a7561a" + +if [ ! -f $ZOOKEEPER_TAR_NAME ]; then echo "Downloading zookeeper..." - download_url="https://github.com/XiaoMi/pegasus-common/releases/download/deps/zookeeper-3.4.6.tar.gz" + download_url="http://pegasus-thirdparty-package.oss-cn-beijing.aliyuncs.com/apache-zookeeper-3.7.0-bin.tar.gz" if ! wget -T 5 -t 1 $download_url; then echo "ERROR: download zookeeper failed" exit 1 fi + if [ `md5sum $ZOOKEEPER_TAR_NAME | awk '{print$1}'` != $ZOOKEEPER_TAR_MD5_VALUE ]; then + echo "check file $ZOOKEEPER_TAR_NAME md5sum failed!" + exit 1 + fi fi -if [ ! -d zookeeper-3.4.6 ]; then +if [ ! -d $ZOOKEEPER_ROOT ]; then echo "Decompressing zookeeper..." - if ! tar xf zookeeper-3.4.6.tar.gz; then + if ! tar xf $ZOOKEEPER_TAR_NAME; then echo "ERROR: decompress zookeeper failed" exit 1 fi fi -ZOOKEEPER_HOME=$(pwd)/zookeeper-3.4.6 +ZOOKEEPER_HOME=`pwd`/$ZOOKEEPER_ROOT ZOOKEEPER_PORT=$PORT -cp "$ZOOKEEPER_HOME"/conf/zoo_sample.cfg "$ZOOKEEPER_HOME"/conf/zoo.cfg -sed -i "s@dataDir=/tmp/zookeeper@dataDir=$ZOOKEEPER_HOME/data@" "$ZOOKEEPER_HOME"/conf/zoo.cfg -sed -i "s@clientPort=2181@clientPort=$ZOOKEEPER_PORT@" "$ZOOKEEPER_HOME"/conf/zoo.cfg +cp $ZOOKEEPER_HOME/conf/zoo_sample.cfg $ZOOKEEPER_HOME/conf/zoo.cfg +sed -i "s@dataDir=/tmp/zookeeper@dataDir=$ZOOKEEPER_HOME/data@" $ZOOKEEPER_HOME/conf/zoo.cfg +sed -i "s@clientPort=2181@clientPort=$ZOOKEEPER_PORT@" $ZOOKEEPER_HOME/conf/zoo.cfg +echo "admin.enableServer=false" >> $ZOOKEEPER_HOME/conf/zoo.cfg +echo "4lw.commands.whitelist=ruok" >> $ZOOKEEPER_HOME/conf/zoo.cfg -mkdir -p "$ZOOKEEPER_HOME"/data -"$ZOOKEEPER_HOME"/bin/zkServer.sh start +mkdir -p $ZOOKEEPER_HOME/data +$ZOOKEEPER_HOME/bin/zkServer.sh start +sleep 1 zk_check_count=0 while true; do diff --git a/scripts/stop_zk.sh b/scripts/stop_zk.sh index 7382615b8f..da06a91bf2 100755 --- a/scripts/stop_zk.sh +++ b/scripts/stop_zk.sh @@ -27,7 +27,7 @@ fi cd $INSTALL_DIR -ZOOKEEPER_HOME=`pwd`/zookeeper-3.4.6 +ZOOKEEPER_HOME=`pwd`/apache-zookeeper-3.7.0-bin if [ -d "$ZOOKEEPER_HOME" ] then diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 4b6c70de62..d6fc99a4d1 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -41,13 +41,13 @@ set(MY_PROJ_LIBS pegasus_reporter pegasus_base pegasus_client_static - zookeeper_mt event galaxy-fds-sdk-cpp PocoNet PocoFoundation PocoNetSSL PocoJSON + hashtable ) set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) diff --git a/src/server/test/CMakeLists.txt b/src/server/test/CMakeLists.txt index 4bd8558b2a..836aee4768 100644 --- a/src/server/test/CMakeLists.txt +++ b/src/server/test/CMakeLists.txt @@ -49,7 +49,6 @@ set(MY_PROJ_LIBS pegasus_reporter RocksDB::rocksdb pegasus_client_static - zookeeper_mt event galaxy-fds-sdk-cpp PocoNet @@ -59,6 +58,7 @@ set(MY_PROJ_LIBS pegasus_base gtest gmock + hashtable ) add_definitions(-DPEGASUS_UNIT_TEST) add_definitions(-DENABLE_FAIL)