You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
resolved PR comments for cs_package_manager.sh & mcs_backup_manager.sh
This commit is contained in:
committed by
Alan Mologorsky
parent
66996bec22
commit
2f17c819a2
@ -2837,11 +2837,11 @@ validation_prechecks_for_dbrm_restore() {
|
|||||||
|
|
||||||
# Confirm bucket connection
|
# Confirm bucket connection
|
||||||
if [ "$storage" == "S3" ]; then
|
if [ "$storage" == "S3" ]; then
|
||||||
if ! testS3Connection 1>/dev/null 2>/dev/null; then
|
if testS3Connection 1>/dev/null 2>/dev/null; then
|
||||||
|
echo " - S3 Connection works"
|
||||||
|
else
|
||||||
printf "\n[!] Failed testS3Connection\n\n"
|
printf "\n[!] Failed testS3Connection\n\n"
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
|
||||||
echo " - S3 Connection works"
|
|
||||||
fi
|
fi
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
@ -2849,11 +2849,12 @@ validation_prechecks_for_dbrm_restore() {
|
|||||||
if [ ! -f "cs_package_manager.sh" ]; then
|
if [ ! -f "cs_package_manager.sh" ]; then
|
||||||
wget https://raw.githubusercontent.com/mariadb-corporation/mariadb-columnstore-engine/develop/extra/cs_package_manager.sh; chmod +x cs_package_manager.sh;
|
wget https://raw.githubusercontent.com/mariadb-corporation/mariadb-columnstore-engine/develop/extra/cs_package_manager.sh; chmod +x cs_package_manager.sh;
|
||||||
fi;
|
fi;
|
||||||
if ! source cs_package_manager.sh source ;then
|
if source cs_package_manager.sh source ;then
|
||||||
|
echo " - Sourced cs_package_manager.sh"
|
||||||
|
else
|
||||||
printf "\n[!!] Failed to source cs_package_manager.sh\n\n"
|
printf "\n[!!] Failed to source cs_package_manager.sh\n\n"
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
|
||||||
echo " - Sourced cs_package_manager.sh"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Confirm the function exists and the source of cs_package_manager.sh worked
|
# Confirm the function exists and the source of cs_package_manager.sh worked
|
||||||
@ -2930,17 +2931,42 @@ process_dbrm_backup() {
|
|||||||
if ! $quiet; then printf "[+] Complete\n\n"; fi;
|
if ! $quiet; then printf "[+] Complete\n\n"; fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Small augmentation of https://github.com/mariadb-corporation/mariadb-columnstore-engine/blob/develop/cmapi/check_ready.sh
|
||||||
|
cmapi_check_ready() {
|
||||||
|
SEC_TO_WAIT=15
|
||||||
|
cmapi_success=false
|
||||||
|
for i in $(seq 1 $SEC_TO_WAIT); do
|
||||||
|
printf "."
|
||||||
|
if ! $(curl -k -s --output /dev/null --fail https://127.0.0.1:8640/cmapi/ready); then
|
||||||
|
sleep 1
|
||||||
|
else
|
||||||
|
cmapi_success=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if $cmapi_success; then
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
printf "\nCMAPI not ready after waiting $SEC_TO_WAIT seconds. Check log file for further details.\n\n"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
confirm_cmapi_online_and_configured() {
|
confirm_cmapi_online_and_configured() {
|
||||||
cmapi_current_status=$(mcs cmapi is-ready 2> /dev/null);
|
cmapi_current_status=$(mcs cmapi is-ready 2> /dev/null);
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|
||||||
# if cmapi is not online - check systemd is running and start cmapi
|
# if cmapi is not online - check systemd is running and start cmapi
|
||||||
if [ "$(ps -p 1 -o comm=)" = "systemd" ]; then
|
if [ "$(ps -p 1 -o comm=)" = "systemd" ]; then
|
||||||
eval $cmapi_start_command
|
if systemctl start mariadb-columnstore-cmapi; then
|
||||||
sleep 2;
|
cmapi_check_ready
|
||||||
|
else
|
||||||
|
echo "[!!] Failed to start CMAPI"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "systemd is not running - cant start cmapi"
|
printf "systemd is not running - cant start cmapi\n\n"
|
||||||
echo ""
|
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -2959,11 +2985,11 @@ confirm_cmapi_online_and_configured() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
confirm_cmapi_configured
|
confirm_nodes_configured
|
||||||
}
|
}
|
||||||
|
|
||||||
# currently supports singlenode only
|
# currently supports singlenode only
|
||||||
confirm_cmapi_configured() {
|
confirm_nodes_configured() {
|
||||||
# Check for edge case of cmapi not configured
|
# Check for edge case of cmapi not configured
|
||||||
if [ "$(mcs cluster status | jq -r '.num_nodes')" == "0" ]; then
|
if [ "$(mcs cluster status | jq -r '.num_nodes')" == "0" ]; then
|
||||||
printf "[!!] Noticed cmapi installed but no nodes configured...\n"
|
printf "[!!] Noticed cmapi installed but no nodes configured...\n"
|
||||||
@ -2975,7 +3001,6 @@ confirm_cmapi_configured() {
|
|||||||
is_cmapi_installed() {
|
is_cmapi_installed() {
|
||||||
|
|
||||||
cmapi_installed_command=""
|
cmapi_installed_command=""
|
||||||
cmapi_start_command="systemctl start mariadb-columnstore-cmapi";
|
|
||||||
case $package_manager in
|
case $package_manager in
|
||||||
yum )
|
yum )
|
||||||
cmapi_installed_command="yum list installed MariaDB-columnstore-cmapi &> /dev/null;";
|
cmapi_installed_command="yum list installed MariaDB-columnstore-cmapi &> /dev/null;";
|
||||||
@ -2999,21 +3024,17 @@ is_cmapi_installed() {
|
|||||||
start_mariadb_cmapi_columnstore() {
|
start_mariadb_cmapi_columnstore() {
|
||||||
|
|
||||||
printf " - Starting MariaDB Server ... "
|
printf " - Starting MariaDB Server ... "
|
||||||
if ! systemctl start mariadb; then
|
if systemctl start mariadb; then
|
||||||
|
printf "Done\n"
|
||||||
|
else
|
||||||
echo "[!!] Failed to start mariadb"
|
echo "[!!] Failed to start mariadb"
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
|
||||||
printf "Done\n"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_cmapi_installed ; then
|
if is_cmapi_installed ; then
|
||||||
|
|
||||||
confirm_cmapi_online_and_configured
|
|
||||||
printf " - Starting CMAPI ... "
|
printf " - Starting CMAPI ... "
|
||||||
if ! systemctl start mariadb-columnstore-cmapi; then
|
if confirm_cmapi_online_and_configured ; then
|
||||||
echo "[!!] Failed to start CMAPI"
|
|
||||||
exit 1;
|
|
||||||
else
|
|
||||||
printf "Done\n"
|
printf "Done\n"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -3040,7 +3061,6 @@ shutdown_columnstore_mariadb_cmapi() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if is_cmapi_installed ; then
|
if is_cmapi_installed ; then
|
||||||
confirm_cmapi_online_and_configured
|
|
||||||
printf " - Stopping CMAPI ... "
|
printf " - Stopping CMAPI ... "
|
||||||
if ! systemctl stop mariadb-columnstore-cmapi; then
|
if ! systemctl stop mariadb-columnstore-cmapi; then
|
||||||
echo "[!!] Failed to stop CMAPI"
|
echo "[!!] Failed to stop CMAPI"
|
||||||
|
@ -255,8 +255,11 @@ check_package_managers() {
|
|||||||
fi;
|
fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_mac_dependancies() {
|
# Confirms mac have critical binaries to run this script
|
||||||
|
# As of 3/2024 mac only supports cs_package_manager.sh check
|
||||||
|
check_mac_dependencies() {
|
||||||
|
|
||||||
|
# Install ggrep if not exists
|
||||||
if ! which ggrep >/dev/null 2>&1; then
|
if ! which ggrep >/dev/null 2>&1; then
|
||||||
echo "Attempting Auto install of ggrep"
|
echo "Attempting Auto install of ggrep"
|
||||||
|
|
||||||
@ -267,6 +270,7 @@ check_mac_dependancies() {
|
|||||||
brew install grep
|
brew install grep
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Exit if ggrep still doesnt exist
|
||||||
if ! which ggrep >/dev/null 2>&1; then
|
if ! which ggrep >/dev/null 2>&1; then
|
||||||
echo "Failed to install ggrep"
|
echo "Failed to install ggrep"
|
||||||
echo "which ggrep"
|
echo "which ggrep"
|
||||||
@ -278,9 +282,9 @@ check_mac_dependancies() {
|
|||||||
|
|
||||||
check_operating_system() {
|
check_operating_system() {
|
||||||
|
|
||||||
if [[ -e "/System/Library/CoreServices/SystemVersion.plist" ]]; then
|
if [[ $OSTYPE == 'darwin'* ]]; then
|
||||||
echo "Running on macOS"
|
echo "Running on macOS"
|
||||||
check_mac_dependancies
|
check_mac_dependencies
|
||||||
|
|
||||||
# on action=check - these values are used as triggers to prompt the user to select what OS/version they want to check against
|
# on action=check - these values are used as triggers to prompt the user to select what OS/version they want to check against
|
||||||
distro_info="mac"
|
distro_info="mac"
|
||||||
@ -953,6 +957,8 @@ do_install() {
|
|||||||
printf "\nDone\n\n"
|
printf "\nDone\n\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# A quick way for mac users to select an OS when running "cs_package_manager.sh check"
|
||||||
|
# since theres no /etc/os-release to auto detect what OS & version to search the mariadb repos on mac
|
||||||
prompt_user_for_os() {
|
prompt_user_for_os() {
|
||||||
|
|
||||||
# Prompt the user to select an operating system
|
# Prompt the user to select an operating system
|
||||||
@ -1011,8 +1017,6 @@ prompt_user_for_os() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do_check() {
|
do_check() {
|
||||||
|
|
||||||
check_operating_system
|
check_operating_system
|
||||||
|
Reference in New Issue
Block a user