Skip to content

Commit

Permalink
feat: zookeeper client support kerberos
Browse files Browse the repository at this point in the history
  • Loading branch information
GehaFearless committed Apr 18, 2022
1 parent 13a4ee5 commit 42a2d72
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion rdsn
Submodule rdsn updated 35 files
+4 −4 .github/workflows/pull_request.yaml
+1 −1 include/dsn/dist/replication/replica_envs.h
+1 −1 scripts/linux/clear_zk.sh
+20 −10 scripts/linux/start_zk.sh
+1 −1 scripts/linux/stop_zk.sh
+1 −1 src/common/replication_common.cpp
+1 −0 src/failure_detector/test/CMakeLists.txt
+1 −1 src/meta/CMakeLists.txt
+36 −15 src/meta/app_env_validator.cpp
+3 −1 src/meta/test/CMakeLists.txt
+1 −0 src/meta/test/balancer_simulator/CMakeLists.txt
+27 −1 src/meta/test/meta_app_envs_test.cpp
+1 −0 src/meta/test/meta_state/CMakeLists.txt
+1 −0 src/replica/backup/test/CMakeLists.txt
+1 −0 src/replica/bulk_load/test/CMakeLists.txt
+2 −1 src/replica/duplication/test/CMakeLists.txt
+12 −1 src/replica/replica.cpp
+24 −1 src/replica/replica.h
+7 −2 src/replica/replica_2pc.cpp
+19 −2 src/replica/replica_config.cpp
+1 −1 src/replica/replica_disk_migrator.cpp
+1 −0 src/replica/split/test/CMakeLists.txt
+1 −1 src/replica/storage/simple_kv/CMakeLists.txt
+2 −1 src/replica/storage/simple_kv/test/CMakeLists.txt
+2 −1 src/replica/test/CMakeLists.txt
+26 −0 src/replica/test/replica_test.cpp
+17 −0 src/runtime/security/init.cpp
+3 −0 src/runtime/security/init.h
+4 −2 src/runtime/security/kinit_context.cpp
+4 −0 src/runtime/security/negotiation.cpp
+10 −0 src/runtime/service_api_c.cpp
+3 −1 src/zookeeper/CMakeLists.txt
+4 −1 src/zookeeper/test/CMakeLists.txt
+33 −6 src/zookeeper/zookeeper_session.cpp
+19 −41 thirdparty/CMakeLists.txt
2 changes: 1 addition & 1 deletion scripts/clear_zk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 21 additions & 10 deletions scripts/start_zk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/stop_zk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/server/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ set(MY_PROJ_LIBS
pegasus_reporter
RocksDB::rocksdb
pegasus_client_static
zookeeper_mt
event
galaxy-fds-sdk-cpp
PocoNet
Expand All @@ -59,6 +58,7 @@ set(MY_PROJ_LIBS
pegasus_base
gtest
gmock
hashtable
)
add_definitions(-DPEGASUS_UNIT_TEST)
add_definitions(-DENABLE_FAIL)
Expand Down

0 comments on commit 42a2d72

Please sign in to comment.