You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-10 01:22:48 +03:00
chore(install): no more deps for awk and ps for postinstall script
This commit is contained in:
@@ -5,11 +5,76 @@
|
|||||||
# Post-install steps for columnstore install
|
# Post-install steps for columnstore install
|
||||||
|
|
||||||
running_systemd() {
|
running_systemd() {
|
||||||
if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then
|
# Check if init process (PID 1) is systemd by reading /proc/1/comm
|
||||||
echo 0
|
if [ -r "/proc/1/comm" ]; then
|
||||||
else
|
if [ "$(cat /proc/1/comm)" = "systemd" ]; then
|
||||||
echo 1
|
echo 0
|
||||||
fi
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Alternative check using /proc/1/exe symlink
|
||||||
|
if [ -L "/proc/1/exe" ]; then
|
||||||
|
local exe_target
|
||||||
|
exe_target=$(readlink -f "/proc/1/exe")
|
||||||
|
if [[ "${exe_target##*/}" == "systemd" ]]; then
|
||||||
|
echo 0
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback check for systemd presence in /run/systemd
|
||||||
|
if [ -d "/run/systemd/system" ]; then
|
||||||
|
echo 0
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 1
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_parent_pid() {
|
||||||
|
local pid=$1
|
||||||
|
local ppid
|
||||||
|
|
||||||
|
# Read the stat file for the given PID
|
||||||
|
if [ -f "/proc/$pid/stat" ]; then
|
||||||
|
# Read the entire stat file into a variable
|
||||||
|
read -r stat <"/proc/$pid/stat"
|
||||||
|
|
||||||
|
# Split into array (parent PID is the 4th field)
|
||||||
|
IFS=' ' read -ra stat_array <<<"$stat"
|
||||||
|
|
||||||
|
# The PPID is the 4th element (0-based index 3)
|
||||||
|
ppid=${stat_array[3]}
|
||||||
|
|
||||||
|
echo "$ppid"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "Error: Process $pid does not exist" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_env_var_value() {
|
||||||
|
local pid=$1
|
||||||
|
local var_name=$2
|
||||||
|
local env_file="/proc/$pid/environ"
|
||||||
|
|
||||||
|
if [ ! -r "$env_file" ]; then
|
||||||
|
echo "Error: Cannot read $env_file" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read null-delimited environ file and process each line
|
||||||
|
while IFS= read -r -d '' line; do
|
||||||
|
if [[ "$line" == "${var_name}="* ]]; then
|
||||||
|
echo "${line#*=}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done <"$env_file"
|
||||||
|
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function recursively(up to PID 1) searches for
|
# This function recursively(up to PID 1) searches for
|
||||||
@@ -18,67 +83,66 @@ find_env_var() {
|
|||||||
env_var_name=$1
|
env_var_name=$1
|
||||||
pid=$$
|
pid=$$
|
||||||
ENV_VAR=''
|
ENV_VAR=''
|
||||||
while [ -z "$ENV_VAR" -a "$pid" != 1 ]; do
|
while [ -z "$ENV_VAR" -a "$pid" != 1 ]; do
|
||||||
ppid=$(ps -oppid -p$pid|tail -1|awk '{print $1}')
|
ppid=$(get_parent_pid $pid)
|
||||||
# This condition is true in containers
|
# This condition is true in containers
|
||||||
if [ "$ppid" == 0 ]; then
|
if [ "$ppid" == 0 ]; then
|
||||||
break;
|
break
|
||||||
fi
|
fi
|
||||||
env=$(strings /proc/$ppid/environ)
|
ENV_VAR=$(get_env_var_value $ppid $env_var_name)
|
||||||
ENV_VAR=$(echo "$env"|awk -F= "\$1 == \"$env_var_name\" { print \$2; }")
|
|
||||||
pid=$ppid
|
pid=$ppid
|
||||||
done
|
done
|
||||||
echo $ENV_VAR
|
echo $ENV_VAR
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -f /etc/mysql/debian.cnf ]]; then
|
if [[ -f /etc/mysql/debian.cnf ]]; then
|
||||||
MDB="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
MDB="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
||||||
else
|
else
|
||||||
MDB="/usr/bin/mysql"
|
MDB="/usr/bin/mysql"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
checkForError() {
|
checkForError() {
|
||||||
# check for password error
|
# check for password error
|
||||||
grep "ERROR 1045" ${installLogDir}/mysql_install.log > ${installLogDir}/error.check
|
grep "ERROR 1045" ${installLogDir}/mysql_install.log >${installLogDir}/error.check
|
||||||
if [ `cat ${installLogDir}/error.check | wc -c` -ne 0 ]; then
|
if [ $(cat ${installLogDir}/error.check | wc -c) -ne 0 ]; then
|
||||||
echo "There were authentication issues running install_mcs_mysql.sh \
|
echo "There were authentication issues running install_mcs_mysql.sh \
|
||||||
script. The log is available in ${installLogDir}/mysql_install.log. Please re-run \
|
script. The log is available in ${installLogDir}/mysql_install.log. Please re-run \
|
||||||
columnstore-post-install manually after solving the authentication issues."
|
columnstore-post-install manually after solving the authentication issues."
|
||||||
rm -f ${installLogDir}/error.check
|
rm -f ${installLogDir}/error.check
|
||||||
return 2;
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${installLogDir}/error.check
|
rm -f ${installLogDir}/error.check
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# See if engine columnstore exist
|
# See if engine columnstore exist
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
echo "checking for engine columnstore..."
|
echo "checking for engine columnstore..."
|
||||||
$MDB --execute="show engines" 2> ${installLogDir}/post-mysql-install.log | grep -i columnstore >> ${installLogDir}/post-mysql-install.log 2>&1
|
$MDB --execute="show engines" 2>${installLogDir}/post-mysql-install.log | grep -i columnstore >>${installLogDir}/post-mysql-install.log 2>&1
|
||||||
|
|
||||||
#
|
#
|
||||||
# Add compressiontype column to SYSCOLUMN if applicable
|
# Add compressiontype column to SYSCOLUMN if applicable
|
||||||
#
|
#
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "columnstore doesn't exist"
|
echo "columnstore doesn't exist"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "columnstore exists"
|
echo "columnstore exists"
|
||||||
|
|
||||||
return 0;
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
rpmmode=install
|
rpmmode=install
|
||||||
user=`whoami 2>/dev/null`
|
user=$(whoami 2>/dev/null)
|
||||||
|
|
||||||
quiet=0
|
quiet=0
|
||||||
|
|
||||||
stop_mysqld=0
|
stop_mysqld=0
|
||||||
if [ -z "$(pgrep -x mariadbd)" ];then
|
if [ -z "$(pgrep -x mariadbd)" ]; then
|
||||||
|
|
||||||
# Startup mysqld
|
# Startup mysqld
|
||||||
systemctl cat mariadb.service > /dev/null 2>&1
|
systemctl cat mariadb.service >/dev/null 2>&1
|
||||||
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
||||||
systemctl start mariadb.service
|
systemctl start mariadb.service
|
||||||
else
|
else
|
||||||
@@ -107,12 +171,11 @@ if [ -f @ENGINE_SYSCONFDIR@/columnstore/Columnstore.xml.rpmsave ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
touch /dev/shm/columnstore-test && rm /dev/shm/columnstore-test
|
touch /dev/shm/columnstore-test && rm /dev/shm/columnstore-test
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "User $user will need R/W access to /dev/shm."
|
echo "User $user will need R/W access to /dev/shm."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
profileFile="/etc/profile.d/columnstoreAlias.sh"
|
profileFile="/etc/profile.d/columnstoreAlias.sh"
|
||||||
/bin/cp -f @ENGINE_SUPPORTDIR@/columnstoreAlias /etc/profile.d/columnstoreAlias.sh
|
/bin/cp -f @ENGINE_SUPPORTDIR@/columnstoreAlias /etc/profile.d/columnstoreAlias.sh
|
||||||
chmod 644 /etc/profile.d/columnstoreAlias.sh >/dev/null 2>&1
|
chmod 644 /etc/profile.d/columnstoreAlias.sh >/dev/null 2>&1
|
||||||
@@ -124,7 +187,7 @@ test -d @ENGINE_LOGDIR@/trace || mkdir @ENGINE_LOGDIR@/trace >/dev/null 2>&1
|
|||||||
test -d @ENGINE_LOGDIR@/cpimport || mkdir @ENGINE_LOGDIR@/cpimport >/dev/null 2>&1
|
test -d @ENGINE_LOGDIR@/cpimport || mkdir @ENGINE_LOGDIR@/cpimport >/dev/null 2>&1
|
||||||
test -d @ENGINE_LOGDIR@/install || mkdir @ENGINE_LOGDIR@/install >/dev/null 2>&1
|
test -d @ENGINE_LOGDIR@/install || mkdir @ENGINE_LOGDIR@/install >/dev/null 2>&1
|
||||||
test -h @ENGINE_LOGDIR@/data && rm -f @ENGINE_LOGDIR@/data
|
test -h @ENGINE_LOGDIR@/data && rm -f @ENGINE_LOGDIR@/data
|
||||||
chmod 755 @ENGINE_LOGDIR@/corefiles > /dev/null 2>&1
|
chmod 755 @ENGINE_LOGDIR@/corefiles >/dev/null 2>&1
|
||||||
chmod 777 @ENGINE_LOGDIR@/cpimport
|
chmod 777 @ENGINE_LOGDIR@/cpimport
|
||||||
chmod 777 @ENGINE_LOGDIR@/install
|
chmod 777 @ENGINE_LOGDIR@/install
|
||||||
installLogDir=@ENGINE_LOGDIR@/install
|
installLogDir=@ENGINE_LOGDIR@/install
|
||||||
@@ -136,7 +199,7 @@ test -d @ENGINE_DATADIR@/data1/systemFiles/dataTransaction || rmdir @ENGINE_DATA
|
|||||||
test -d @ENGINE_DATADIR@/data1/systemFiles/dataTransaction/archive || rmdir @ENGINE_DATADIR@/data1/systemFiles/dataTransaction/archive >/dev/null 2>&1
|
test -d @ENGINE_DATADIR@/data1/systemFiles/dataTransaction/archive || rmdir @ENGINE_DATADIR@/data1/systemFiles/dataTransaction/archive >/dev/null 2>&1
|
||||||
chmod 1755 @ENGINE_DATADIR@/data1 >/dev/null 2>&1
|
chmod 1755 @ENGINE_DATADIR@/data1 >/dev/null 2>&1
|
||||||
chmod -R 1755 @ENGINE_DATADIR@/data1/systemFiles >/dev/null 2>&1
|
chmod -R 1755 @ENGINE_DATADIR@/data1/systemFiles >/dev/null 2>&1
|
||||||
chmod 1755 @ENGINE_SYSCONFDIR@/columnstore > /dev/null 2>&1
|
chmod 1755 @ENGINE_SYSCONFDIR@/columnstore >/dev/null 2>&1
|
||||||
|
|
||||||
#create the bulk-load dirs
|
#create the bulk-load dirs
|
||||||
mkdir -p @ENGINE_LOGDIR@/data/bulk/data/import >/dev/null 2>&1
|
mkdir -p @ENGINE_LOGDIR@/data/bulk/data/import >/dev/null 2>&1
|
||||||
@@ -147,28 +210,28 @@ rm -f @ENGINE_LOGDIR@/data/bulk/tmpjob/* >/dev/null 2>&1
|
|||||||
chmod -R 777 @ENGINE_LOGDIR@/data
|
chmod -R 777 @ENGINE_LOGDIR@/data
|
||||||
|
|
||||||
#get columnstore temp file directory name
|
#get columnstore temp file directory name
|
||||||
tmpDir=`@ENGINE_BINDIR@/mcsGetConfig SystemConfig SystemTempFileDir`
|
tmpDir=$(@ENGINE_BINDIR@/mcsGetConfig SystemConfig SystemTempFileDir)
|
||||||
scratchDir=$tmpDir`@ENGINE_BINDIR@/mcsGetConfig SystemConfig hdfsRdwrScratch`
|
scratchDir=$tmpDir$(@ENGINE_BINDIR@/mcsGetConfig SystemConfig hdfsRdwrScratch)
|
||||||
mkdir $tmpDir >/dev/null 2>&1
|
mkdir $tmpDir >/dev/null 2>&1
|
||||||
mkdir $scratchDir >/dev/null 2>&1
|
mkdir $scratchDir >/dev/null 2>&1
|
||||||
chmod 777 $tmpDir
|
chmod 777 $tmpDir
|
||||||
chmod 777 $scratchDir
|
chmod 777 $scratchDir
|
||||||
|
|
||||||
#create mount directories
|
#create mount directories
|
||||||
mkdir /mnt/tmp > /dev/null 2>&1
|
mkdir /mnt/tmp >/dev/null 2>&1
|
||||||
|
|
||||||
if [ $user = "root" ]; then
|
if [ $user = "root" ]; then
|
||||||
#setup the columnstore service script
|
#setup the columnstore service script
|
||||||
rm -f /etc/init.d/columnstore >/dev/null 2>&1
|
rm -f /etc/init.d/columnstore >/dev/null 2>&1
|
||||||
rm -f /etc/default/columnstore
|
rm -f /etc/default/columnstore
|
||||||
|
|
||||||
systemctl=`which systemctl 2>/dev/null`
|
systemctl=$(which systemctl 2>/dev/null)
|
||||||
if [ -n "$systemctl" ]; then
|
if [ -n "$systemctl" ]; then
|
||||||
# Removing a separate ExeMgr unit.
|
# Removing a separate ExeMgr unit.
|
||||||
if [[ -f /usr/lib/systemd/system/mcs-exemgr.service ]]; then
|
if [[ -f /usr/lib/systemd/system/mcs-exemgr.service ]]; then
|
||||||
rm -f /usr/lib/systemd/system/mcs-exemgr.service
|
rm -f /usr/lib/systemd/system/mcs-exemgr.service
|
||||||
fi
|
fi
|
||||||
if [[ -f /lib/systemd/system/mcs-exemgr.service ]]; then
|
if [[ -f /lib/systemd/system/mcs-exemgr.service ]]; then
|
||||||
rm -f /lib/systemd/system/mcs-exemgr.service
|
rm -f /lib/systemd/system/mcs-exemgr.service
|
||||||
fi
|
fi
|
||||||
cp @ENGINE_SUPPORTDIR@/mariadb-columnstore.service /usr/lib/systemd/system/. >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mariadb-columnstore.service /usr/lib/systemd/system/. >/dev/null 2>&1
|
||||||
@@ -181,7 +244,7 @@ if [ $user = "root" ]; then
|
|||||||
cp @ENGINE_SUPPORTDIR@/mcs-dmlproc.service /lib/systemd/system/. >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-dmlproc.service /lib/systemd/system/. >/dev/null 2>&1
|
||||||
cp @ENGINE_SUPPORTDIR@/mcs-primproc.service /usr/lib/systemd/system/. >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-primproc.service /usr/lib/systemd/system/. >/dev/null 2>&1
|
||||||
cp @ENGINE_SUPPORTDIR@/mcs-primproc.service /lib/systemd/system/. >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-primproc.service /lib/systemd/system/. >/dev/null 2>&1
|
||||||
cp @ENGINE_SUPPORTDIR@/mcs-workernode.service /usr/lib/systemd/system/mcs-workernode@.service >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-workernode.service /usr/lib/systemd/system/mcs-workernode@.service >/dev/null 2>&1
|
||||||
cp @ENGINE_SUPPORTDIR@/mcs-workernode.service /lib/systemd/system/mcs-workernode@.service >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-workernode.service /lib/systemd/system/mcs-workernode@.service >/dev/null 2>&1
|
||||||
cp @ENGINE_SUPPORTDIR@/mcs-writeengineserver.service /usr/lib/systemd/system/. >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-writeengineserver.service /usr/lib/systemd/system/. >/dev/null 2>&1
|
||||||
cp @ENGINE_SUPPORTDIR@/mcs-writeengineserver.service /lib/systemd/system/. >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-writeengineserver.service /lib/systemd/system/. >/dev/null 2>&1
|
||||||
@@ -190,27 +253,27 @@ if [ $user = "root" ]; then
|
|||||||
cp @ENGINE_SUPPORTDIR@/mcs-storagemanager.service /usr/lib/systemd/system/. >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-storagemanager.service /usr/lib/systemd/system/. >/dev/null 2>&1
|
||||||
cp @ENGINE_SUPPORTDIR@/mcs-storagemanager.service /lib/systemd/system/. >/dev/null 2>&1
|
cp @ENGINE_SUPPORTDIR@/mcs-storagemanager.service /lib/systemd/system/. >/dev/null 2>&1
|
||||||
systemctl enable mariadb-columnstore >/dev/null 2>&1
|
systemctl enable mariadb-columnstore >/dev/null 2>&1
|
||||||
systemctl enable mcs-controllernode > /dev/null 2>&1
|
systemctl enable mcs-controllernode >/dev/null 2>&1
|
||||||
systemctl enable mcs-ddlproc > /dev/null 2>&1
|
systemctl enable mcs-ddlproc >/dev/null 2>&1
|
||||||
systemctl enable mcs-dmlproc > /dev/null 2>&1
|
systemctl enable mcs-dmlproc >/dev/null 2>&1
|
||||||
systemctl enable mcs-primproc > /dev/null 2>&1
|
systemctl enable mcs-primproc >/dev/null 2>&1
|
||||||
systemctl enable mcs-workernode@1 > /dev/null 2>&1
|
systemctl enable mcs-workernode@1 >/dev/null 2>&1
|
||||||
systemctl enable mcs-writeengineserver > /dev/null 2>&1
|
systemctl enable mcs-writeengineserver >/dev/null 2>&1
|
||||||
systemctl enable mcs-loadbrm > /dev/null 2>&1
|
systemctl enable mcs-loadbrm >/dev/null 2>&1
|
||||||
systemctl enable mcs-storagemanager > /dev/null 2>&1
|
systemctl enable mcs-storagemanager >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
chkconfig=`which chkconfig 2>/dev/null`
|
chkconfig=$(which chkconfig 2>/dev/null)
|
||||||
if [ -n "$chkconfig" ]; then
|
if [ -n "$chkconfig" ]; then
|
||||||
|
|
||||||
cp @ENGINE_SBINDIR@/columnstore /etc/init.d/. >/dev/null 2>&1
|
cp @ENGINE_SBINDIR@/columnstore /etc/init.d/. >/dev/null 2>&1
|
||||||
chkconfig --add columnstore > /dev/null 2>&1
|
chkconfig --add columnstore >/dev/null 2>&1
|
||||||
chkconfig columnstore on > /dev/null 2>&1
|
chkconfig columnstore on >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
cp @ENGINE_SBINDIR@/columnstore /etc/init.d/. >/dev/null 2>&1
|
cp @ENGINE_SBINDIR@/columnstore /etc/init.d/. >/dev/null 2>&1
|
||||||
updaterc=`which update-rc.d 2>/dev/null`
|
updaterc=$(which update-rc.d 2>/dev/null)
|
||||||
if [ -n "$updaterc" ]; then
|
if [ -n "$updaterc" ]; then
|
||||||
|
|
||||||
update-rc.d columnstore defaults 99 > /dev/null 2>&1
|
update-rc.d columnstore defaults 99 >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
echo "Package 'systemctl', 'chkconfig' or 'update-rc.d' not installed, contact your sysadmin if you want to setup to autostart for columnstore"
|
echo "Package 'systemctl', 'chkconfig' or 'update-rc.d' not installed, contact your sysadmin if you want to setup to autostart for columnstore"
|
||||||
@@ -221,12 +284,12 @@ fi
|
|||||||
|
|
||||||
# upgrade the columnstore.cnf file
|
# upgrade the columnstore.cnf file
|
||||||
if [ -f @MARIADB_MYCNFDIR@/columnstore.cnf.rpmsave ]; then
|
if [ -f @MARIADB_MYCNFDIR@/columnstore.cnf.rpmsave ]; then
|
||||||
cp -f @MARIADB_MYCNFDIR@/columnstore.cnf @MARIADB_MYCNFDIR@/columnstore.cnf.new
|
cp -f @MARIADB_MYCNFDIR@/columnstore.cnf @MARIADB_MYCNFDIR@/columnstore.cnf.new
|
||||||
cp -f @MARIADB_MYCNFDIR@/columnstore.cnf.rpmsave @MARIADB_MYCNFDIR@/columnstore.cnf
|
cp -f @MARIADB_MYCNFDIR@/columnstore.cnf.rpmsave @MARIADB_MYCNFDIR@/columnstore.cnf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $user = "root" ]; then
|
if [ $user = "root" ]; then
|
||||||
@ENGINE_BINDIR@/columnstoreSyslogSetup.sh install > $installLogDir/syslog_install.log 2>&1
|
@ENGINE_BINDIR@/columnstoreSyslogSetup.sh install >$installLogDir/syslog_install.log 2>&1
|
||||||
|
|
||||||
#check if MariaDB Columnstore system logging was setup
|
#check if MariaDB Columnstore system logging was setup
|
||||||
cat $installLogDir/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
|
cat $installLogDir/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
|
||||||
@@ -236,7 +299,7 @@ if [ $user = "root" ]; then
|
|||||||
else
|
else
|
||||||
chown $user:$user @ENGINE_SYSCONFDIR@/columnstore/Columnstore.xml
|
chown $user:$user @ENGINE_SYSCONFDIR@/columnstore/Columnstore.xml
|
||||||
|
|
||||||
cat <<EOD
|
cat <<EOD
|
||||||
|
|
||||||
NOTE: For non-root install, you will need to run the following commands as root user to
|
NOTE: For non-root install, you will need to run the following commands as root user to
|
||||||
setup the MariaDB ColumnStore System Logging
|
setup the MariaDB ColumnStore System Logging
|
||||||
@@ -262,12 +325,12 @@ rm -f $lockdir/columnstore
|
|||||||
@ENGINE_SBINDIR@/install_mcs_mysql.sh --tmpdir=$installLogDir
|
@ENGINE_SBINDIR@/install_mcs_mysql.sh --tmpdir=$installLogDir
|
||||||
|
|
||||||
# Restart MDB to enable plugin
|
# Restart MDB to enable plugin
|
||||||
systemctl cat mariadb.service > /dev/null 2>&1
|
systemctl cat mariadb.service >/dev/null 2>&1
|
||||||
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
||||||
systemctl restart mariadb.service > /dev/null 2>&1
|
systemctl restart mariadb.service >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
pkill mysqld > /dev/null 2>&1
|
pkill mysqld >/dev/null 2>&1
|
||||||
while [ -n "$(pgrep -x mysqld)" ] ; do
|
while [ -n "$(pgrep -x mysqld)" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
/usr/bin/mysqld_safe &
|
/usr/bin/mysqld_safe &
|
||||||
@@ -286,88 +349,88 @@ fi
|
|||||||
$MDB <@ENGINE_SUPPORTDIR@/syscatalog_mysql.sql 2>/dev/null
|
$MDB <@ENGINE_SUPPORTDIR@/syscatalog_mysql.sql 2>/dev/null
|
||||||
|
|
||||||
if [ -z "$MCS_USE_S3_STORAGE" ]; then
|
if [ -z "$MCS_USE_S3_STORAGE" ]; then
|
||||||
MCS_USE_S3_STORAGE="$(find_env_var "MCS_USE_S3_STORAGE")"
|
MCS_USE_S3_STORAGE="$(find_env_var "MCS_USE_S3_STORAGE")"
|
||||||
MCS_S3_BUCKET="$(find_env_var "MCS_S3_BUCKET")"
|
MCS_S3_BUCKET="$(find_env_var "MCS_S3_BUCKET")"
|
||||||
MCS_S3_ENDPOINT="$(find_env_var "MCS_S3_ENDPOINT")"
|
MCS_S3_ENDPOINT="$(find_env_var "MCS_S3_ENDPOINT")"
|
||||||
MCS_S3_ACCESS_KEY_ID="$(find_env_var "MCS_S3_ACCESS_KEY_ID")"
|
MCS_S3_ACCESS_KEY_ID="$(find_env_var "MCS_S3_ACCESS_KEY_ID")"
|
||||||
MCS_S3_SECRET_ACCESS_KEY="$(find_env_var "MCS_S3_SECRET_ACCESS_KEY")"
|
MCS_S3_SECRET_ACCESS_KEY="$(find_env_var "MCS_S3_SECRET_ACCESS_KEY")"
|
||||||
MCS_S3_REGION="$(find_env_var "MCS_S3_REGION")"
|
MCS_S3_REGION="$(find_env_var "MCS_S3_REGION")"
|
||||||
MCS_S3_ROLE_NAME="$(find_env_var "MCS_S3_ROLE_NAME")"
|
MCS_S3_ROLE_NAME="$(find_env_var "MCS_S3_ROLE_NAME")"
|
||||||
MCS_S3_STS_REGION="$(find_env_var "MCS_S3_STS_REGION")"
|
MCS_S3_STS_REGION="$(find_env_var "MCS_S3_STS_REGION")"
|
||||||
MCS_S3_STS_ENDPOINT="$(find_env_var "MCS_S3_STS_ENDPOINT")"
|
MCS_S3_STS_ENDPOINT="$(find_env_var "MCS_S3_STS_ENDPOINT")"
|
||||||
MCS_S3_USE_HTTP="$(find_env_var "MCS_S3_USE_HTTP")"
|
MCS_S3_USE_HTTP="$(find_env_var "MCS_S3_USE_HTTP")"
|
||||||
MCS_S3_NO_SSL_VERIFY="$(find_env_var "MCS_S3_NO_SSL_VERIFY")"
|
MCS_S3_NO_SSL_VERIFY="$(find_env_var "MCS_S3_NO_SSL_VERIFY")"
|
||||||
MCS_S3_LIBS3_DEBUG="$(find_env_var "MCS_S3_LIBS3_DEBUG")"
|
MCS_S3_LIBS3_DEBUG="$(find_env_var "MCS_S3_LIBS3_DEBUG")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$MCS_USE_S3_STORAGE" ] && [ $MCS_USE_S3_STORAGE -eq 1 ]; then
|
if [ ! -z "$MCS_USE_S3_STORAGE" ] && [ $MCS_USE_S3_STORAGE -eq 1 ]; then
|
||||||
if [ -z "$MCS_S3_BUCKET" ]; then
|
if [ -z "$MCS_S3_BUCKET" ]; then
|
||||||
echo "Environment variable \$MCS_USE_S3_STORAGE is set but there is no \$MCS_S3_BUCKET."
|
echo "Environment variable \$MCS_USE_S3_STORAGE is set but there is no \$MCS_S3_BUCKET."
|
||||||
fi
|
fi
|
||||||
if [ -z "$MCS_S3_ACCESS_KEY_ID" ] && [ -z "$MCS_S3_ROLE_NAME" ]; then
|
if [ -z "$MCS_S3_ACCESS_KEY_ID" ] && [ -z "$MCS_S3_ROLE_NAME" ]; then
|
||||||
echo "Environment variable \$MCS_USE_S3_STORAGE is set but there is no \$MCS_S3_ACCESS_KEY_ID."
|
echo "Environment variable \$MCS_USE_S3_STORAGE is set but there is no \$MCS_S3_ACCESS_KEY_ID."
|
||||||
fi
|
fi
|
||||||
if [ -z "$MCS_S3_SECRET_ACCESS_KEY" ] && [ -z "$MCS_S3_ROLE_NAME" ]; then
|
if [ -z "$MCS_S3_SECRET_ACCESS_KEY" ] && [ -z "$MCS_S3_ROLE_NAME" ]; then
|
||||||
echo "Environment variable \$MCS_USE_S3_STORAGE is set but there is no \$MCS_S3_SECRET_ACCESS_KEY."
|
echo "Environment variable \$MCS_USE_S3_STORAGE is set but there is no \$MCS_S3_SECRET_ACCESS_KEY."
|
||||||
fi
|
fi
|
||||||
if [ -z "$MCS_S3_BUCKET" ] || [[ -z "$MCS_S3_ACCESS_KEY_ID" && -z "$MCS_S3_ROLE_NAME" ]] || [[ -z "$MCS_S3_SECRET_ACCESS_KEY" && -z "$MCS_S3_ROLE_NAME" ]]; then
|
if [ -z "$MCS_S3_BUCKET" ] || [[ -z "$MCS_S3_ACCESS_KEY_ID" && -z "$MCS_S3_ROLE_NAME" ]] || [[ -z "$MCS_S3_SECRET_ACCESS_KEY" && -z "$MCS_S3_ROLE_NAME" ]]; then
|
||||||
echo "Using local storage."
|
echo "Using local storage."
|
||||||
@ENGINE_BINDIR@/mcsSetConfig -d Installation DBRootStorageType "storagemanager"
|
@ENGINE_BINDIR@/mcsSetConfig -d Installation DBRootStorageType "storagemanager"
|
||||||
@ENGINE_BINDIR@/mcsSetConfig -d StorageManager Enabled "Y"
|
@ENGINE_BINDIR@/mcsSetConfig -d StorageManager Enabled "Y"
|
||||||
@ENGINE_BINDIR@/mcsSetConfig -d SystemConfig DataFilePlugin "libcloudio.so"
|
@ENGINE_BINDIR@/mcsSetConfig -d SystemConfig DataFilePlugin "libcloudio.so"
|
||||||
else
|
else
|
||||||
@ENGINE_BINDIR@/mcsSetConfig -d Installation DBRootStorageType "storagemanager"
|
@ENGINE_BINDIR@/mcsSetConfig -d Installation DBRootStorageType "storagemanager"
|
||||||
@ENGINE_BINDIR@/mcsSetConfig -d StorageManager Enabled "Y"
|
@ENGINE_BINDIR@/mcsSetConfig -d StorageManager Enabled "Y"
|
||||||
@ENGINE_BINDIR@/mcsSetConfig -d SystemConfig DataFilePlugin "libcloudio.so"
|
@ENGINE_BINDIR@/mcsSetConfig -d SystemConfig DataFilePlugin "libcloudio.so"
|
||||||
sed -i "s|^service =.*|service = S3|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^service =.*|service = S3|" /etc/columnstore/storagemanager.cnf
|
||||||
if [ ! -z "$MCS_S3_REGION" ]; then
|
if [ ! -z "$MCS_S3_REGION" ]; then
|
||||||
sed -i "s|^region =.*|region = $MCS_S3_REGION|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^region =.*|region = $MCS_S3_REGION|" /etc/columnstore/storagemanager.cnf
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$MCS_S3_ROLE_NAME" ]; then
|
if [ ! -z "$MCS_S3_ROLE_NAME" ]; then
|
||||||
sed -i "s|^# iam_role_name =.*|iam_role_name = $MCS_S3_ROLE_NAME|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# iam_role_name =.*|iam_role_name = $MCS_S3_ROLE_NAME|" /etc/columnstore/storagemanager.cnf
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$MCS_S3_STS_REGION" ]; then
|
if [ ! -z "$MCS_S3_STS_REGION" ]; then
|
||||||
sed -i "s|^# sts_region =.*|sts_region = $MCS_S3_STS_REGION|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# sts_region =.*|sts_region = $MCS_S3_STS_REGION|" /etc/columnstore/storagemanager.cnf
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$MCS_S3_STS_ENDPOINT" ]; then
|
if [ ! -z "$MCS_S3_STS_ENDPOINT" ]; then
|
||||||
sed -i "s|^# sts_endpoint =.*|sts_endpoint = $MCS_S3_STS_ENDPOINT|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# sts_endpoint =.*|sts_endpoint = $MCS_S3_STS_ENDPOINT|" /etc/columnstore/storagemanager.cnf
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$MCS_S3_USE_HTTP" ]; then
|
if [ ! -z "$MCS_S3_USE_HTTP" ]; then
|
||||||
sed -i "s|^# use_http =.*|use_http = enabled|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# use_http =.*|use_http = enabled|" /etc/columnstore/storagemanager.cnf
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$MCS_S3_NO_SSL_VERIFY" ]; then
|
if [ ! -z "$MCS_S3_NO_SSL_VERIFY" ]; then
|
||||||
sed -i "s|^# ssl_verify =.*|ssl_verify = disabled|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# ssl_verify =.*|ssl_verify = disabled|" /etc/columnstore/storagemanager.cnf
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$MCS_S3_LIBS3_DEBUG" ]; then
|
if [ ! -z "$MCS_S3_LIBS3_DEBUG" ]; then
|
||||||
sed -i "s|^# libs3_debug =.*|libs3_debug = enabled|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# libs3_debug =.*|libs3_debug = enabled|" /etc/columnstore/storagemanager.cnf
|
||||||
fi
|
fi
|
||||||
sed -i "s|^bucket =.*|bucket = $MCS_S3_BUCKET|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^bucket =.*|bucket = $MCS_S3_BUCKET|" /etc/columnstore/storagemanager.cnf
|
||||||
sed -i "s|^# endpoint =.*|endpoint = $MCS_S3_ENDPOINT|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# endpoint =.*|endpoint = $MCS_S3_ENDPOINT|" /etc/columnstore/storagemanager.cnf
|
||||||
sed -i "s|^# aws_access_key_id =.*|aws_access_key_id = $MCS_S3_ACCESS_KEY_ID|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# aws_access_key_id =.*|aws_access_key_id = $MCS_S3_ACCESS_KEY_ID|" /etc/columnstore/storagemanager.cnf
|
||||||
sed -i "s|^# aws_secret_access_key =.*|aws_secret_access_key = $MCS_S3_SECRET_ACCESS_KEY|" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^# aws_secret_access_key =.*|aws_secret_access_key = $MCS_S3_SECRET_ACCESS_KEY|" /etc/columnstore/storagemanager.cnf
|
||||||
@ENGINE_BINDIR@/testS3Connection
|
@ENGINE_BINDIR@/testS3Connection
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
sed -i "s|^iam_role_name =.*|# iam_role_name = |" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^iam_role_name =.*|# iam_role_name = |" /etc/columnstore/storagemanager.cnf
|
||||||
sed -i "s|^sts_region =.*|# sts_region = |" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^sts_region =.*|# sts_region = |" /etc/columnstore/storagemanager.cnf
|
||||||
sed -i "s|^sts_endpoint =.*|# sts_endpoint = |" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^sts_endpoint =.*|# sts_endpoint = |" /etc/columnstore/storagemanager.cnf
|
||||||
sed -i "s|^endpoint =.*|# endpoint = |" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^endpoint =.*|# endpoint = |" /etc/columnstore/storagemanager.cnf
|
||||||
sed -i "s|^aws_access_key_id =.*|# aws_access_key_id = |" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^aws_access_key_id =.*|# aws_access_key_id = |" /etc/columnstore/storagemanager.cnf
|
||||||
sed -i "s|^aws_secret_access_key =.*|# aws_secret_access_key = |" /etc/columnstore/storagemanager.cnf
|
sed -i "s|^aws_secret_access_key =.*|# aws_secret_access_key = |" /etc/columnstore/storagemanager.cnf
|
||||||
echo "There was an error validating the settings used to access S3."
|
echo "There was an error validating the settings used to access S3."
|
||||||
echo "The specified user or role must have GET, PUT, HEAD, and DELETE permissions to the bucket."
|
echo "The specified user or role must have GET, PUT, HEAD, and DELETE permissions to the bucket."
|
||||||
echo "Verify the following environment variables are correct:"
|
echo "Verify the following environment variables are correct:"
|
||||||
echo "MCS_S3_BUCKET"
|
echo "MCS_S3_BUCKET"
|
||||||
echo "MCS_S3_ENDPOINT"
|
echo "MCS_S3_ENDPOINT"
|
||||||
echo "MCS_S3_ACCESS_KEY_ID"
|
echo "MCS_S3_ACCESS_KEY_ID"
|
||||||
echo "MCS_S3_SECRET_ACCESS_KEY"
|
echo "MCS_S3_SECRET_ACCESS_KEY"
|
||||||
echo "MCS_S3_REGION"
|
echo "MCS_S3_REGION"
|
||||||
echo "MCS_S3_ROLE_NAME (optional)"
|
echo "MCS_S3_ROLE_NAME (optional)"
|
||||||
echo "MCS_S3_STS_REGION (optional)"
|
echo "MCS_S3_STS_REGION (optional)"
|
||||||
echo "MCS_S3_STS_ENDPOINT (optional)"
|
echo "MCS_S3_STS_ENDPOINT (optional)"
|
||||||
echo "After environment variables are fixed, run command: columnstore-post-install"
|
echo "After environment variables are fixed, run command: columnstore-post-install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#change ownership/permissions to be able to run columnstore as non-root
|
#change ownership/permissions to be able to run columnstore as non-root
|
||||||
@@ -375,7 +438,7 @@ fi
|
|||||||
if [ $(running_systemd) -eq 0 ]; then
|
if [ $(running_systemd) -eq 0 ]; then
|
||||||
chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ @ENGINE_LOGDIR@
|
chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ @ENGINE_LOGDIR@
|
||||||
chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ /etc/columnstore
|
chown -R @DEFAULT_USER@:@DEFAULT_GROUP@ /etc/columnstore
|
||||||
findcmd=`which find 2>/dev/null`
|
findcmd=$(which find 2>/dev/null)
|
||||||
if [ -n "$findcmd" ]; then
|
if [ -n "$findcmd" ]; then
|
||||||
if [[ $($findcmd @ENGINE_DATADIR@ -maxdepth 3 ! -user @DEFAULT_USER@ -exec echo {} \; -quit 2>/dev/null) ]]; then
|
if [[ $($findcmd @ENGINE_DATADIR@ -maxdepth 3 ! -user @DEFAULT_USER@ -exec echo {} \; -quit 2>/dev/null) ]]; then
|
||||||
echo "At least one file is not owned by @DEFAULT_USER@ in @ENGINE_DATADIR@. Running chown..."
|
echo "At least one file is not owned by @DEFAULT_USER@ in @ENGINE_DATADIR@. Running chown..."
|
||||||
@@ -390,7 +453,7 @@ if [ $(running_systemd) -eq 0 ]; then
|
|||||||
chmod 777 /dev/shm
|
chmod 777 /dev/shm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl cat mariadb-columnstore.service > /dev/null 2>&1
|
systemctl cat mariadb-columnstore.service >/dev/null 2>&1
|
||||||
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
||||||
|
|
||||||
# mask mariadb-columnstore service to prevent starting services and dbbuilder
|
# mask mariadb-columnstore service to prevent starting services and dbbuilder
|
||||||
@@ -421,13 +484,13 @@ if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
|||||||
flock -u "$fd_lock"
|
flock -u "$fd_lock"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $stop_mysqld -eq 1 ];then
|
if [ $stop_mysqld -eq 1 ]; then
|
||||||
# Make sure we stop mariadb since it wasn't running prior to columnstore installation
|
# Make sure we stop mariadb since it wasn't running prior to columnstore installation
|
||||||
systemctl cat mariadb.service > /dev/null 2>&1
|
systemctl cat mariadb.service >/dev/null 2>&1
|
||||||
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
||||||
systemctl stop mariadb.service > /dev/null 2>&1
|
systemctl stop mariadb.service >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
pkill mysqld > /dev/null 2>&1
|
pkill mysqld >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user