diff --git a/README.md b/README.md index 83db65e..15105e9 100755 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ The Dockin platform installer supports the rapid deployment of highly available ``` Modify the configuration file: vi conf/install.properties Fill in the parameters according to the format: server_list=(ip1 ip2 ip3) +Please copy /data/app/dockin-etcd/conf/*.pem to other etcd nodes after the installation of etcd, then restart etcd ``` ``` diff --git a/README.zh-CN.md b/README.zh-CN.md index cf5259e..e2022d5 100755 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -49,6 +49,7 @@ Dockin平台安装器,快速部署高可用kubernetes集群、ETCD集群,生 ``` 修改配置文件 vi conf/install.properties 按格式填写参数:server_list=(ip1 ip2 ip3) +安装完成后,请将 /data/app/dockin-etcd/conf/*.pem 拷贝到其他etcd节点,再重启etcd ``` ``` diff --git a/dockin-etcd/install.sh b/dockin-etcd/install.sh index e43c22b..6d97bac 100755 --- a/dockin-etcd/install.sh +++ b/dockin-etcd/install.sh @@ -47,12 +47,10 @@ while true ; do esac done -#安装数据文件主目录 CONTENT_PATH="$SCRIPT_PATH/$(head -n1 .name)" CONTENT_NAME=$(head -n1 .name) [ -d "$CONTENT_PATH" ] || { log CRITICAL "$CONTENT_PATH/ does NOT exist or is NOT a directory."; exit 9; } -# 本次安装的是不是备份服务器,备份服务器在安装结束时不会执行start.sh,但是在安装的过程中stop.sh�?定会执行�?次�?? IS_BACKUP_SERVER=$OPT_BACKUP if [ -z "$IS_BACKUP_SERVER" ];then [[ "$M_START_SERVER" == true ]] && IS_BACKUP_SERVER=false @@ -61,13 +59,12 @@ fi [ -z "$IS_BACKUP_SERVER" ] && IS_BACKUP_SERVER=false [[ "$IS_BACKUP_SERVER" != false && "$IS_BACKUP_SERVER" != true ]] && { log ERRROR "value is invalid [$IS_BACKUP_SERVER]."; exit 33; } -# decide install settings(command line options > M_* env variables > install.conf ). -# 安装目标目录 + DEPLOY_PATH=${OPT_PATH} [ -z "$DEPLOY_PATH" ] && DEPLOY_PATH="/data/app/$CONTENT_NAME" APP_NAME=$(basename "$DEPLOY_PATH") DATA_PATH="/data/$APP_NAME/data" -#如果指定data目录,则替换data目录 + if [ ! "$OPT_DATA_PATH" = "" ]; then DATA_PATH=$OPT_DATA_PATH fi @@ -82,7 +79,6 @@ CONFIGS=$OPT_CONF [ -z "$CONFIGS" ] && CONFIGS=$M_CONF_NAME [ -z "$CONFIGS" ] && CONFIGS=$CONF_NAME -# 根据配置修改安装配置目录 if [ -z "$CONFIGS" ]; then log INFO "CONFIGS=[$CONFIGS], using default configuration." else @@ -101,7 +97,6 @@ if [ -n "$CONFIGS" ]; then done fi -# 初始化日志目录和服务器目录 if [ ! -e "$LOG_PATH" ]; then log INFO "create log path: $APP_NAME." mkdir -vp "$LOG_PATH" @@ -119,7 +114,6 @@ fi BWLIMIT=1000 -#更新服务器配置目录 if [[ "$OPT_UPDATE_CONFIG" ]]; then log INFO "update config ..." cd ${SCRIPT_PATH} @@ -139,16 +133,21 @@ if [[ "$OPT_UPDATE_CONFIG" ]]; then exit 0; fi -# 关闭服务 +# stop etcd if [[ true != "$OPT_UPDATE_CONFIG_ONLY" && -r $DEPLOY_PATH/bin/stop.sh ]]; then log WARN "old installation found, try to stop old process, if it exists." cd $DEPLOY_PATH/bin sh stop.sh fi -# 安装服务 +# install etcd cd ${SCRIPT_PATH} -rsync -cir --delete --bwlimit=$BWLIMIT "$CONTENT_PATH/" "$DEPLOY_PATH/" --exclude=/logs --exclude=/data --exclude=/tmp --exclude=tomcat --exclude="/.*"; +if [ -f "$DEPLOY_PATH/conf/client-key.pem" ]; then + log WARN "certification already exist" + rsync -cir --delete --bwlimit=$BWLIMIT "$CONTENT_PATH/" "$DEPLOY_PATH/" --exclude=/logs --exclude=/data --exclude=/conf/*.pem --exclude=/tmp --exclude="/.*"; +else + rsync -cir --delete --bwlimit=$BWLIMIT "$CONTENT_PATH/" "$DEPLOY_PATH/" --exclude=/logs --exclude=/data --exclude=/tmp --exclude="/.*"; +fi if [ ! -d "$DEPLOY_PATH/logs" ]; then ln -sf "$LOG_PATH" "$DEPLOY_PATH/logs" @@ -162,7 +161,6 @@ fi chmod 775 ${DEPLOY_PATH}/bin/* -#将二进制文件写到环境变量中 BIN_PATH=$DEPLOY_PATH/bin if [[ $(cat ~/.bashrc | grep "alias" | grep "etcdctl=$BIN_PATH/etcdctl" ) == "" ]]; then echo 'export ETCDCTL_API=3' >> ~/.bashrc @@ -173,7 +171,7 @@ fi [[ -d "$DEPLOY_PATH/scripts" ]] && chmod -R +x ${DEPLOY_PATH}/scripts/ || true -#启动服务 +# start etcd if [[ "$IS_BACKUP_SERVER" == false ]]; then log INFO "starting server..." cd $DEPLOY_PATH/bin