1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

Merge pull request #637 from mariadb-corporation/MCOL-1944

Mcol 1944
This commit is contained in:
benthompson15
2018-11-23 16:58:46 +00:00
committed by GitHub
2 changed files with 60 additions and 39 deletions

View File

@ -315,14 +315,6 @@ if [ -z "aws" ]; then
$installdir/bin/MCSgetCredentials.sh >/dev/null 2>&1 $installdir/bin/MCSgetCredentials.sh >/dev/null 2>&1
fi fi
#log install message
test -f $installdir/post/functions && . $installdir/post/functions
if [ $user = "root" ]; then
$installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****"
else
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib $installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****"
fi
#setup hadoop #setup hadoop
hadoop=`which hadoop 2>/dev/null` hadoop=`which hadoop 2>/dev/null`
if [ -z "$hadoop" ]; then if [ -z "$hadoop" ]; then

View File

@ -11,12 +11,26 @@ prefix=/usr/local
installdir=$prefix/mariadb/columnstore installdir=$prefix/mariadb/columnstore
syslog_conf=nofile syslog_conf=nofile
rsyslog7=0 rsyslog7=0
non_root_user=no
user=`whoami 2>/dev/null` user=`whoami 2>/dev/null`
#set default names
groupname=adm groupname=adm
username=syslog username=syslog
# determine username/groupname
if [ -f /var/log/messages ]; then
username=`stat -c "%U %G" /var/log/messages | awk '{print $1}'`
groupname=`stat -c "%U %G" /var/log/messages | awk '{print $2}'`
fi
if [ -f /var/log/syslog ]; then
username=`stat -c "%U %G" /var/log/syslog | awk '{print $1}'`
groupname=`stat -c "%U %G" /var/log/syslog | awk '{print $2}'`
fi
for arg in "$@"; do for arg in "$@"; do
if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then
prefix="`echo $arg | awk -F= '{print $2}'`" prefix="`echo $arg | awk -F= '{print $2}'`"
@ -28,6 +42,7 @@ for arg in "$@"; do
user="`echo $arg | awk -F= '{print $2}'`" user="`echo $arg | awk -F= '{print $2}'`"
groupname=$user groupname=$user
username=$user username=$user
non_root_user=yes
elif [ `expr -- "$arg" : '--..*'` -ge 3 ]; then elif [ `expr -- "$arg" : '--..*'` -ge 3 ]; then
echo "ignoring unknown argument: $arg" 1>&2 echo "ignoring unknown argument: $arg" 1>&2
elif [ `expr -- "$arg" : '--'` -eq 2 ]; then elif [ `expr -- "$arg" : '--'` -eq 2 ]; then
@ -157,12 +172,17 @@ fi
} }
makeDir() { makeDir() {
test -d /var/log/mariadb/columnstore || mkdir -p /var/log/mariadb/columnstore >/dev/null 2>&1 if [ ! -d /var/log/mariadb/columnstore ]; then
test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1 mkdir -p /var/log/mariadb/columnstore >/dev/null 2>&1
test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1 test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1
test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1 test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1
chmod 777 -R /var/log/mariadb/columnstore test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1
chown $user:$user -R /var/log/mariadb chown $username:$groupname -R /var/log/mariadb
else
test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1
test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1
test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1
fi
} }
install() { install() {
@ -170,15 +190,15 @@ makeDir
checkSyslog checkSyslog
if [ ! -z "$syslog_conf" ] ; then if [ ! -z "$syslog_conf" ] ; then
$installdir/bin/setConfig -d Installation SystemLogConfigFile ${syslog_conf} >/dev/null 2>&1 $installdir/bin/setConfig -d Installation SystemLogConfigFile ${syslog_conf} >/dev/null 2>&1
if [ $user != "root" ]; then if [ $non_root_user == "yes" ]; then
chown $user:$user /home/$user/mariadb/columnstore/etc/* chown $user:$user $installdir/etc/Columnstore.xml*
fi fi
rm -f ${syslog_conf}.columnstoreSave
if [ "$syslog_conf" == /etc/rsyslog.d/columnstore.conf ] || if [ "$syslog_conf" == /etc/rsyslog.d/columnstore.conf ] ||
[ "$syslog_conf" == /etc/rsyslog.d/49-columnstore.conf ]; then [ "$syslog_conf" == /etc/rsyslog.d/49-columnstore.conf ]; then
i=1 i=1
else else
rm -f ${syslog_conf}.columnstoreSave
cp ${syslog_conf} ${syslog_conf}.columnstoreSave >/dev/null 2>&1 cp ${syslog_conf} ${syslog_conf}.columnstoreSave >/dev/null 2>&1
sed -i '/# MariaDB/,$d' ${syslog_conf}.columnstoreSave > /dev/null 2>&1 sed -i '/# MariaDB/,$d' ${syslog_conf}.columnstoreSave > /dev/null 2>&1
fi fi
@ -188,21 +208,6 @@ if [ ! -z "$syslog_conf" ] ; then
#set the syslog for ColumnStore logging #set the syslog for ColumnStore logging
# remove older version incase it was installed by previous build # remove older version incase it was installed by previous build
rm -rf /etc/rsyslog.d/columnstore.conf rm -rf /etc/rsyslog.d/columnstore.conf
# determine username/groupname
if [ -f /var/log/messages ]; then
user=`stat -c "%U %G" /var/log/messages | awk '{print $1}'`
group=`stat -c "%U %G" /var/log/messages | awk '{print $2}'`
fi
if [ -f /var/log/syslog ]; then
user=`stat -c "%U %G" /var/log/syslog | awk '{print $1}'`
group=`stat -c "%U %G" /var/log/syslog | awk '{print $2}'`
fi
# set permissions
chown $user:$group -R /var/log/mariadb > /dev/null 2>&1
if [ $rsyslog7 == 1 ]; then if [ $rsyslog7 == 1 ]; then
rm -f /etc/rsyslog.d/49-columnstore.conf rm -f /etc/rsyslog.d/49-columnstore.conf
@ -210,16 +215,41 @@ if [ ! -z "$syslog_conf" ] ; then
sed -i -e s/groupname/$groupname/g ${syslog_conf} sed -i -e s/groupname/$groupname/g ${syslog_conf}
sed -i -e s/username/$username/g ${syslog_conf} sed -i -e s/username/$username/g ${syslog_conf}
chmod 644 ${syslog_conf}
else else
cp ${columnstoreSyslogFile} ${syslog_conf} cp ${columnstoreSyslogFile} ${syslog_conf}
fi fi
fi fi
# install Columnstore Log Rotate File
cp $installdir/bin/columnstoreLogRotate /etc/logrotate.d/columnstore > /dev/null 2>&1
chmod 644 /etc/logrotate.d/columnstore
restartSyslog restartSyslog
# install Columnstore Log Rotate File
if [ -d /etc/logrotate.d ]; then
cp $installdir/bin/columnstoreLogRotate /etc/logrotate.d/columnstore > /dev/null 2>&1
chmod 644 /etc/logrotate.d/columnstore
#do the logrotate to start with a fresh log file during install
logrotate -f /etc/logrotate.d/columnstore > /dev/null 2>&1
fi
#log install message and find the least permission that allows logging to work
CHMOD_LIST=("750" "770" "775" "777")
for CHMOD in "${CHMOD_LIST[@]}"; do
chmod $CHMOD /var/log/mariadb
chmod $CHMOD /var/log/mariadb/columnstore
chmod $CHMOD /var/log/mariadb/columnstore/archive
chmod $CHMOD /var/log/mariadb/columnstore/corefiles
chmod $CHMOD /var/log/mariadb/columnstore/trace
test -f $installdir/post/functions && . $installdir/post/functions
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib $installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****"
if [ -f /var/log/mariadb/columnstore/info.log ]; then
if [ -s /var/log/mariadb/columnstore/info.log ]; then
exit 0
fi
fi
done
fi fi
} }
@ -233,7 +263,7 @@ if [ ! -z "$syslog_conf" ] ; then
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [ -f ${syslog_conf}.columnstoreSave ] ; then if [ -f ${syslog_conf}.columnstoreSave ] ; then
#uninstall the syslog for ColumnStore logging #uninstall the syslog for ColumnStore logging
v -f ${syslog_conf} ${syslog_conf}.ColumnStoreBackup mv -f ${syslog_conf} ${syslog_conf}.ColumnStoreBackup
mv -f ${syslog_conf}.columnstoreSave ${syslog_conf} >/dev/null 2>&1 mv -f ${syslog_conf}.columnstoreSave ${syslog_conf} >/dev/null 2>&1
if [ ! -f ${syslog_conf} ] ; then if [ ! -f ${syslog_conf} ] ; then
cp ${syslog_conf}.ColumnStoreBackup ${syslog_conf} cp ${syslog_conf}.ColumnStoreBackup ${syslog_conf}
@ -252,7 +282,6 @@ if [ ! -z "$syslog_conf" ] ; then
rm -f /etc/logrotate.d/columnstore rm -f /etc/logrotate.d/columnstore
restartSyslog restartSyslog
fi fi
} }