mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
wsrep_sst_xtrabackup*: use wsrep_sst_common parsed vars
This commit is contained in:
@ -32,8 +32,6 @@ ecode=0
|
||||
ssyslog=""
|
||||
ssystag=""
|
||||
XTRABACKUP_PID=""
|
||||
SST_PORT=""
|
||||
REMOTEIP=""
|
||||
tca=""
|
||||
tcert=""
|
||||
tkey=""
|
||||
@ -41,7 +39,6 @@ sockopt=""
|
||||
progress=""
|
||||
ttime=0
|
||||
totime=0
|
||||
lsn=""
|
||||
ecmd=""
|
||||
rlimit=""
|
||||
# Initially
|
||||
@ -76,11 +73,6 @@ ssl_cert=""
|
||||
ssl_ca=""
|
||||
ssl_key=""
|
||||
|
||||
# Required for backup locks
|
||||
# For backup locks it is 1 sent by joiner
|
||||
# 5.6.21 PXC and later can't donate to an older joiner
|
||||
sst_ver=1
|
||||
|
||||
if which pv &>/dev/null && pv --help | grep -q FORMAT;then
|
||||
pvopts+=$pvformat
|
||||
fi
|
||||
@ -250,11 +242,7 @@ verify_file_exists()
|
||||
|
||||
get_transfer()
|
||||
{
|
||||
if [[ -z $SST_PORT ]];then
|
||||
TSST_PORT=4444
|
||||
else
|
||||
TSST_PORT=$SST_PORT
|
||||
fi
|
||||
TSST_PORT=${WSREP_SST_OPT_PORT:-4444}
|
||||
|
||||
if [[ $tfmt == 'nc' ]];then
|
||||
if [[ ! -x `which nc` ]];then
|
||||
@ -279,7 +267,7 @@ get_transfer()
|
||||
fi
|
||||
else
|
||||
# netcat doesn't understand [] around IPv6 address
|
||||
tcmd="nc ${REMOTEIP//[\[\]]/} ${TSST_PORT}"
|
||||
tcmd="nc ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
|
||||
fi
|
||||
else
|
||||
tfmt='socat'
|
||||
@ -341,7 +329,7 @@ get_transfer()
|
||||
tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},cafile=${tca}${joiner_extra}${sockopt} stdio"
|
||||
else
|
||||
wsrep_log_info "Encrypting with CERT: $tcert, CA: $tca"
|
||||
tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tcert},cafile=${tca}${donor_extra}${sockopt}"
|
||||
tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${tcert},cafile=${tca}${donor_extra}${sockopt}"
|
||||
fi
|
||||
elif [[ $encrypt -eq 3 ]];then
|
||||
wsrep_log_warning "**** WARNING **** encrypt=3 is deprecated and will be removed in a future release"
|
||||
@ -358,7 +346,7 @@ get_transfer()
|
||||
tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},key=${tkey},verify=0${joiner_extra}${sockopt} stdio"
|
||||
else
|
||||
wsrep_log_info "Encrypting with CERT: $tcert, KEY: $tkey"
|
||||
tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tcert},key=${tkey},verify=0${sockopt}"
|
||||
tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${tcert},key=${tkey},verify=0${sockopt}"
|
||||
fi
|
||||
elif [[ $encrypt -eq 4 ]]; then
|
||||
wsrep_log_info "Using openssl based encryption with socat: with key, crt, and ca"
|
||||
@ -379,7 +367,7 @@ get_transfer()
|
||||
tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${joiner_extra}${sockopt} stdio"
|
||||
else
|
||||
wsrep_log_info "Encrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca"
|
||||
tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${donor_extra}${sockopt}"
|
||||
tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${donor_extra}${sockopt}"
|
||||
fi
|
||||
|
||||
else
|
||||
@ -390,7 +378,7 @@ get_transfer()
|
||||
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then
|
||||
tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
|
||||
else
|
||||
tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}"
|
||||
tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -634,18 +622,6 @@ kill_xtrabackup()
|
||||
rm -f "$XTRABACKUP_PID" || true
|
||||
}
|
||||
|
||||
setup_ports()
|
||||
{
|
||||
if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then
|
||||
SST_PORT=$WSREP_SST_OPT_PORT
|
||||
REMOTEIP=$WSREP_SST_OPT_HOST
|
||||
lsn=$(echo $WSREP_SST_OPT_PATH | awk -F '[/]' '{ print $2 }')
|
||||
sst_ver=$(echo $WSREP_SST_OPT_PATH | awk -F '[/]' '{ print $3 }')
|
||||
else
|
||||
SST_PORT=$WSREP_SST_OPT_PORT
|
||||
fi
|
||||
}
|
||||
|
||||
# waits ~1 minute for nc/socat to open the port and then reports ready
|
||||
# (regardless of timeout)
|
||||
wait_for_listen()
|
||||
@ -660,7 +636,7 @@ wait_for_listen()
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
echo "ready ${HOST}:${PORT}/${MODULE}//$sst_ver"
|
||||
echo "ready ${HOST}:${PORT}/${MODULE}//${WSREP_SST_OPT_SST_VER:-1}"
|
||||
}
|
||||
|
||||
check_extra()
|
||||
@ -829,7 +805,6 @@ if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor'
|
||||
fi
|
||||
|
||||
read_cnf
|
||||
setup_ports
|
||||
|
||||
if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; then
|
||||
disver="--no-version-check"
|
||||
@ -895,7 +870,7 @@ then
|
||||
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]
|
||||
then
|
||||
usrst=0
|
||||
if [[ -z $sst_ver ]];then
|
||||
if [[ -z $WSREP_SST_OPT_SST_VER ]];then
|
||||
wsrep_log_error "Upgrade joiner to 5.6.21 or higher for backup locks support"
|
||||
wsrep_log_error "The joiner is not supported for this version of donor"
|
||||
exit 93
|
||||
@ -956,7 +931,7 @@ then
|
||||
wsrep_log_info "Sleeping before data transfer for SST"
|
||||
sleep 10
|
||||
|
||||
wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT:-4444}"
|
||||
wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT:-4444}"
|
||||
|
||||
# Add compression to the head of the stream (if specified)
|
||||
if [[ -n $scomp ]]; then
|
||||
|
@ -30,15 +30,13 @@ encrypt=0
|
||||
nproc=1
|
||||
ecode=0
|
||||
XTRABACKUP_PID=""
|
||||
SST_PORT=""
|
||||
REMOTEIP=""
|
||||
tcert=""
|
||||
tpem=""
|
||||
sockopt=""
|
||||
progress=""
|
||||
ttime=0
|
||||
totime=0
|
||||
lsn=""
|
||||
lsn="${WSREP_SST_OPT_LSN}"
|
||||
incremental=0
|
||||
ecmd=""
|
||||
rlimit=""
|
||||
@ -136,11 +134,7 @@ get_keys()
|
||||
|
||||
get_transfer()
|
||||
{
|
||||
if [[ -z $SST_PORT ]];then
|
||||
TSST_PORT=4444
|
||||
else
|
||||
TSST_PORT=$SST_PORT
|
||||
fi
|
||||
TSST_PORT=${WSREP_SST_OPT_PORT:-4444}
|
||||
|
||||
if [[ $tfmt == 'nc' ]];then
|
||||
if [[ ! -x `which nc` ]];then
|
||||
@ -155,7 +149,7 @@ get_transfer()
|
||||
tcmd="nc -dl ${TSST_PORT}"
|
||||
fi
|
||||
else
|
||||
tcmd="nc ${REMOTEIP} ${TSST_PORT}"
|
||||
tcmd="nc ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
|
||||
fi
|
||||
else
|
||||
tfmt='socat'
|
||||
@ -181,13 +175,13 @@ get_transfer()
|
||||
tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio"
|
||||
else
|
||||
wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert"
|
||||
tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}"
|
||||
tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}"
|
||||
fi
|
||||
else
|
||||
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
|
||||
tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
|
||||
else
|
||||
tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}"
|
||||
tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -343,17 +337,6 @@ kill_xtrabackup()
|
||||
rm -f "$XTRABACKUP_PID"
|
||||
}
|
||||
|
||||
setup_ports()
|
||||
{
|
||||
if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then
|
||||
SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }')
|
||||
REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }')
|
||||
lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }')
|
||||
else
|
||||
SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }')
|
||||
fi
|
||||
}
|
||||
|
||||
# waits ~10 seconds for nc to open the port and then reports ready
|
||||
# (regardless of timeout)
|
||||
wait_for_listen()
|
||||
@ -462,7 +445,7 @@ then
|
||||
|
||||
check_extra
|
||||
|
||||
wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT}"
|
||||
wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT}"
|
||||
|
||||
if [[ -n $progress ]];then
|
||||
get_footprint
|
||||
@ -542,14 +525,9 @@ then
|
||||
# May need xtrabackup_checkpoints later on
|
||||
rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile
|
||||
|
||||
ADDR=${WSREP_SST_OPT_ADDR}
|
||||
if [ -z "${SST_PORT}" ]
|
||||
then
|
||||
SST_PORT=4444
|
||||
ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}"
|
||||
fi
|
||||
ADDR="${WSREP_SST_OPT_HOST}:${WSREP_SST_OPT_PORT:-4444}"
|
||||
|
||||
wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} &
|
||||
wait_for_listen ${WSREP_SST_OPT_PORT:-4444} ${ADDR} ${MODULE} &
|
||||
|
||||
trap sig_joiner_cleanup HUP PIPE INT TERM
|
||||
trap cleanup_joiner EXIT
|
||||
|
Reference in New Issue
Block a user