add: support_specified_observer
This commit is contained in:
parent
0e13ee1fd9
commit
f6a6dcd2be
@ -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"
|
||||
@ -70,6 +88,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
|
||||
@ -81,6 +104,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" ]]
|
||||
@ -376,7 +400,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 {
|
||||
@ -581,11 +618,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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user