提交 2c275236 编写于 作者: O obdev 提交者: ob-robot

add: support_specified_observer

上级 03524c63
......@@ -8,6 +8,24 @@ shopt -s expand_aliases
source $DEPLOY_PATH/activate_obd.sh
tag="latest"
current_path=$(pwd)
if [[ "$current_path" != "$BASE_DIR/tools/deploy" ]]
then
echo "切换至路径[$BASE_DIR/tools/deploy]"
cd $BASE_DIR/tools/deploy || exit 1
fi
function absolute_path {
if [[ "$1" != "" ]]
then
if [[ $(echo "$1" | grep -E '^/') == "" ]]
then
echo ${current_path}/$1
else
echo $1
fi
fi
}
function obd_exec {
echo -e "\033[32m>>> obd $* \033[0m"
......@@ -27,8 +45,8 @@ function variables_parpare {
HOST=$(hostname -i)
DATA_PATH="/data/$(whoami)"
IPADDRESS="127.0.0.1"
export IS_CE=1
COMPONENT="oceanbase-ce"
export IS_CE=1
COMPONENT="oceanbase-ce"
if grep 'dep_create.sh' $BASE_DIR/build.sh 2>&1 >/dev/null
then
......@@ -37,6 +55,8 @@ function variables_parpare {
DEP_PATH=$BASE_DIR/rpm/.dep_create/var
fi
export LD_LIBRARY_PATH=$DEP_PATH/u01/obclient/lib:$LD_LIBRARY_PATH
OBCLIENT_BIN=$DEP_PATH/u01/obclient/bin/obclient
MYSQLTEST_BIN=$DEP_PATH/u01/obclient/bin/mysqltest
......@@ -61,6 +81,11 @@ function mirror_create {
fi
# observer mirror create
if [[ "$OBSERVER_PATH" != "" ]]
then
mkdir -p $BASE_DIR/tools/deploy/{bin,etc,admin}
cp -f $OBSERVER_PATH $OBSERVER_BIN || exit 1
fi
obs_version=$($OBSERVER_BIN -V 2>&1 | grep -E "observer \(OceanBase([ \_]CE)? ([.0-9]+)\)" | grep -Eo '([.0-9]+)')
if [[ "$obs_version" == "" ]]
then
......@@ -72,6 +97,7 @@ function mirror_create {
export IS_CE="0"
[[ $($OBSERVER_BIN -V 2>&1 | grep -E 'OceanBase[_ ]CE') ]] && COMPONENT="oceanbase-ce" && export IS_CE="1"
fi
$OBSERVER_BIN -V
[[ -f "$BASE_DIR/tools/deploy/obd/.observer_obd_plugin_version" ]] && obs_version=$(cat $BASE_DIR/tools/deploy/obd/.observer_obd_plugin_version)
obs_mirror_info=$(obd_exec mirror create -n $COMPONENT -p "$DEPLOY_PATH" -V "$obs_version" -t $tag -f) && success=1
if [[ "$success" != "1" ]]
......@@ -371,7 +397,20 @@ function upgreade_cluster {
function destroy_cluster {
get_deploy_name
obd cluster destroy "$deploy_name" -f
if [[ ! -e "$OBD_CLUSTER_PATH/$deploy_name" ]]
then
exit 1
fi
if [[ "$(grep 'status: STATUS_DESTROYED' $OBD_CLUSTER_PATH/$deploy_name/.data)" == "" ]]
then
obd cluster destroy "$deploy_name" -f
fi
if [[ "$RM_CLUSTER" == "1" ]]
then
rm -rf $OBD_CLUSTER_PATH/$deploy_name
else
echo "Use --rm to remove deploy $deploy_name dir"
fi
}
function reinstall_cluster {
......@@ -577,11 +616,18 @@ function main() {
--skip-copy ) SKIP_COPY="1"; shift ;;
--mini) MINI="1"; shift ;;
--port ) export port_gen="$2"; extra_args="$extra_args $1"; shift ;;
--observer ) OBSERVER_PATH="$2"; shift 2 ;;
--rm ) RM_CLUSTER="1"; shift ;;
-- ) shift ;;
"" ) break ;;
* ) extra_args="$extra_args $1"; [[ "$1" == "--help" || "$1" == "-h" ]] && HELP="1" ; shift ;;
esac
done
YAML_CONF=$(absolute_path ${YAML_CONF})
DATA_PATH=$(absolute_path ${DATA_PATH})
OBSERVER_PATH=$(absolute_path ${OBSERVER_PATH})
if [[ "$MINI" == "1" && "$DISABLE_REBOOT" != "1" ]]
then
NEED_REBOOT="1"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册