You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-09-02 12:41:17 +03:00
337 lines
11 KiB
Bash
Executable File
337 lines
11 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# $Id: post-install 3705 2013-08-07 19:47:20Z dhill $
|
|
#
|
|
# Post-install steps for columnstore install
|
|
|
|
prefix=/usr/local
|
|
installdir=$prefix/MariaDB/Columnstore
|
|
rpmmode=install
|
|
user=$USER
|
|
if [ -z "$user" ]; then
|
|
user=root
|
|
fi
|
|
quiet=0
|
|
|
|
for arg in "$@"; do
|
|
if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then
|
|
prefix="`echo $arg | awk -F= '{print $2}'`"
|
|
installdir=$prefix/MariaDB/Columnstore
|
|
elif [ `expr -- "$arg" : '--rpmmode='` -eq 10 ]; then
|
|
rpmmode="`echo $arg | awk -F= '{print $2}'`"
|
|
elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then
|
|
installdir="`echo $arg | awk -F= '{print $2}'`"
|
|
prefix=`dirname $installdir`
|
|
elif [ `expr -- "$arg" : '--user='` -eq 7 ]; then
|
|
user="`echo $arg | awk -F= '{print $2}'`"
|
|
elif [ `expr -- "$arg" : '--quiet'` -eq 7 ]; then
|
|
quiet=1
|
|
elif [ `expr -- "$arg" : '--plugin='` -eq 9 ]; then
|
|
plugin="`echo $arg | awk -F= '{print $2}'`"
|
|
else
|
|
echo "post-install: ignoring unknown argument: $arg" 1>&2
|
|
fi
|
|
done
|
|
|
|
if [ $installdir != "/usr/local/MariaDB/Columnstore" ]; then
|
|
export INFINIDB_INSTALL_DIR=$installdir
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib
|
|
else
|
|
# add library config file
|
|
/bin/cp -f $installdir/bin/infinidb.conf /etc/ld.so.conf.d/.
|
|
ldconfig
|
|
fi
|
|
|
|
#check 64-bit OS compatiable
|
|
arch=`uname -m`
|
|
patcnt=`expr "$arch" : 'i.86'`
|
|
is64bitos=1
|
|
if [ $patcnt -ne 0 ]; then
|
|
is64bitos=0
|
|
fi
|
|
is64bitpkg=1
|
|
file $installdir/bin/PrimProc | grep '64-bit' >/dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
is64bitpkg=0
|
|
fi
|
|
if [ $is64bitpkg -eq 1 -a $is64bitos -ne 1 ]; then
|
|
echo "ERROR: Incompatiable Version, package is intended for a x86_64 architecture"
|
|
echo "exiting...."
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f $installdir/etc/Calpont.xml ]; then
|
|
echo "$installdir/etc/Calpont.xml not found, exiting"
|
|
exit 1
|
|
fi
|
|
|
|
cd $installdir/lib || exit 1
|
|
for lib in *.so.1.0.0; do
|
|
blib=`basename $lib .1.0.0`
|
|
ln -sf $lib $blib
|
|
done
|
|
chown -h $user.$user *.so >/dev/null 2>&1
|
|
if [ -f libnetsnmp.so.5.2.1 ]; then
|
|
for lib in *.so.5.2.1; do
|
|
blib=`basename $lib .5.2.1`
|
|
ln -sf $lib $blib
|
|
ln -sf $lib ${blib}.5
|
|
done
|
|
chown -h $user.$user *.so *.so.5 >/dev/null 2>&1
|
|
fi
|
|
if [ -f libstdc++.so.6.0.14 ]; then
|
|
ln -sf libstdc++.so.6.0.14 libstdc++.so.6
|
|
chown -h $user.$user libstdc++.so.6 >/dev/null 2>&1
|
|
fi
|
|
|
|
ln -sf libjemalloc.so.3.3.0 libjemalloc.so
|
|
chown -h $user.$user libjemalloc.so >/dev/null 2>&1
|
|
|
|
# TODO-based on early experience with HDP it doesn't install bigtop
|
|
# so the code below will not correctly detect JAVA_HOME. Need to
|
|
# decide how to handle
|
|
# Autodetect JAVA_HOME if not defined
|
|
#if [ -e /usr/libexec/bigtop-detect-javahome ]; then
|
|
#. /usr/libexec/bigtop-detect-javahome
|
|
#elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ]; then
|
|
#. /usr/lib/bigtop-utils/bigtop-detect-javahome
|
|
#fi
|
|
#ln -sf $JAVA_HOME/jre/lib/amd64/server/libjvm.so
|
|
#chown -h $user.$user libjvm.so >/dev/null 2>&1
|
|
|
|
cd /
|
|
|
|
test -d /var/log/Calpont || mkdir /var/log/Calpont >/dev/null 2>&1
|
|
test -d /var/log/Calpont/archive || mkdir /var/log/Calpont/archive >/dev/null 2>&1
|
|
test -d /var/log/Calpont/corefiles || mkdir /var/log/Calpont/corefiles >/dev/null 2>&1
|
|
test -d /var/log/Calpont/trace || mkdir /var/log/Calpont/trace >/dev/null 2>&1
|
|
test -h /var/log/Calpont/data && rm -f /var/log/Calpont/data
|
|
test -d /var/log/Calpont/data || mkdir /var/log/Calpont/data >/dev/null 2>&1
|
|
# make sure trace dir is world-writable and sticky
|
|
chmod 1755 /var/log/Calpont/trace >/dev/null 2>&1
|
|
test -d $installdir/data || mkdir $installdir/data
|
|
test -d $installdir/data1 || mkdir $installdir/data1
|
|
test -d $installdir/data1/systemFiles || mkdir $installdir/data1/systemFiles
|
|
test -d $installdir/data1/systemFiles/dbrm || mkdir $installdir/data1/systemFiles/dbrm
|
|
test -d $installdir/data1/systemFiles/dataTransaction || rmdir $installdir/data1/systemFiles/dataTransaction >/dev/null 2>&1
|
|
test -d $installdir/data1/systemFiles/dataTransaction/archive || rmdir $installdir/data1/systemFiles/dataTransaction/archive >/dev/null 2>&1
|
|
chmod 1755 $installdir/data1 >/dev/null 2>&1
|
|
chmod -R 1755 $installdir/data1/systemFiles >/dev/null 2>&1
|
|
chmod 1755 $installdir/etc > /dev/null 2>&1
|
|
|
|
#create the bulk-load dirs
|
|
mkdir -p $installdir/data/bulk/data/import >/dev/null 2>&1
|
|
mkdir -p $installdir/data/bulk/log >/dev/null 2>&1
|
|
mkdir -p $installdir/data/bulk/job >/dev/null 2>&1
|
|
mkdir -p $installdir/data/bulk/rollback >/dev/null 2>&1
|
|
mkdir -p $installdir/data/bulk/tmpjob >/dev/null 2>&1
|
|
rm -f $installdir/data/bulk/tmpjob/* >/dev/null 2>&1
|
|
chmod -R 755 $installdir/data/bulk >/dev/null 2>&1
|
|
|
|
#create infinidb temp file directory
|
|
mkdir -p /tmp/infinidb_tmp_files >/dev/null 2>&1
|
|
|
|
#setup core file directory and link
|
|
mkdir /var/log/Calpont/corefiles > /dev/null 2>&1
|
|
chmod 755 /var/log/Calpont/corefiles > /dev/null 2>&1
|
|
|
|
#create mount directories
|
|
mkdir /mnt/tmp > /dev/null 2>&1
|
|
mkdir /var/log/Calpont/data/archive > /dev/null 2>&1
|
|
|
|
# install Calpont Log Rotate File
|
|
test -d $installdir/mysql/db || mkdir -p $installdir/mysql/db
|
|
cp $installdir/bin/columnstoreLogRotate /etc/logrotate.d/columnstore > /dev/null 2>&1
|
|
rm -rf $installdir/mysql/db/infinidb_log_archive > /dev/null 2>&1
|
|
|
|
# delete Calpont shared memory segments
|
|
$installdir/bin/Calpont/bin/clearShm > /dev/null 2>&1
|
|
|
|
#setup the infinidb service script
|
|
rm -f /etc/init.d/infinidb >/dev/null 2>&1
|
|
cp $installdir/bin/infinidb /etc/init.d >/dev/null 2>&1
|
|
if [ -x /sbin/chkconfig ]; then
|
|
/sbin/chkconfig --add infinidb > /dev/null 2>&1
|
|
/sbin/chkconfig infinidb on > /dev/null 2>&1
|
|
elif [ -x /usr/sbin/update-rc.d ]; then
|
|
/usr/sbin/update-rc.d infinidb defaults 99 > /dev/null 2>&1
|
|
else
|
|
echo ""
|
|
echo "Package 'chkconfig' or 'update-rc.d' not installed, contact your sysadmin if you want to setup to autostart for infinidb"
|
|
fi
|
|
|
|
#setup InfiniDB system logging
|
|
if [ $user = "root" ]; then
|
|
$installdir/bin/syslogSetup.sh install > /tmp/syslog_install.log 2>&1
|
|
chmod 777 -R /dev/shm
|
|
rm -f /etc/default/infinidb
|
|
else
|
|
sudo $installdir/bin/syslogSetup.sh --installdir=$installdir install > /tmp/syslog_install.log 2>&1
|
|
sudo chown $user:$user $installdir/etc/Calpont.xml
|
|
sudo chmod 755 /var/log
|
|
sudo chmod -R 755 /var/log/Calpont
|
|
sudo chmod -R 777 /dev/shm
|
|
sudo rm -f /var/lock/subsys/mysql-Calpont
|
|
sudo rm -f /tmp/StopCalpont
|
|
|
|
sed -i -e s@/usr/local/MariaDB/Columnstore@$installdir@g $installdir/bin/infinidb.def
|
|
sudo cp $installdir/bin/infinidb.def /etc/default/infinidb
|
|
fi
|
|
|
|
#check if InfiniDB system logging was setup
|
|
cat /tmp/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
|
|
if [ $? -eq 0 ]; then
|
|
cat /tmp/syslog_install.log
|
|
fi
|
|
|
|
#setup alias commands
|
|
eval userhome=~$user
|
|
bashFile=$userhome/.bashrc
|
|
touch ${bashFile}
|
|
if [ $installdir != "/usr/local/MariaDB/Columnstore" ]; then
|
|
sed -i -e s@/usr/local/MariaDB/Columnstore@$installdir@g $installdir/bin/columnstoreAlias
|
|
fi
|
|
egrep -qs 'Calpont Database Platform Alias Commands' ${bashFile}
|
|
rc1=$?
|
|
egrep -qs 'InfiniDB Alias Commands' ${bashFile}
|
|
rc2=$?
|
|
if [ $rc1 -ne 0 -a $rc2 -ne 0 ]; then
|
|
rm -f ${bashFile}.columnstoreSave
|
|
cp ${bashFile} ${bashFile}.columnstoreSave >/dev/null 2>&1
|
|
cat $installdir/bin/columnstoreAlias >> ${bashFile}
|
|
echo " " >> ${bashFile}
|
|
fi
|
|
|
|
#check and get amazon EC2 env variables
|
|
if [ -n "$EC2_HOME" ]; then
|
|
$installdir/bin/setConfig -d Installation EC2_HOME $EC2_HOME
|
|
|
|
if [ -n "$EC2_HOME" ]; then
|
|
$installdir/bin/setConfig -d Installation JAVA_HOME $JAVA_HOME
|
|
fi
|
|
|
|
$installdir/bin/setConfig -d Installation EC2_PATH $PATH:/home/ec2/bin:/opt/aws/bin
|
|
fi
|
|
|
|
#log install message
|
|
test -f $installdir/post/functions && . $installdir/post/functions
|
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib $installdir/bin/cplogger -i 19 "***** InfiniDB Installed *****"
|
|
|
|
#setup hadoop
|
|
hadoop=`which hadoop 2>/dev/null`
|
|
if [ -z $hadoop ]; then
|
|
#check for non-root user
|
|
if [ $installdir != "/usr/local/MariaDB/Columnstore" -a $quiet -eq 0 ]; then
|
|
cat <<EOD
|
|
The next steps are:
|
|
|
|
export INFINIDB_INSTALL_DIR=$installdir
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib:$installdir/mysql/lib/mysql
|
|
$installdir/bin/postConfigure -i $installdir
|
|
|
|
EOD
|
|
else
|
|
cat <<EOD
|
|
The next step is:
|
|
|
|
$installdir/bin/postConfigure
|
|
|
|
EOD
|
|
fi
|
|
exit 0
|
|
else
|
|
chmod 755 $installdir/bin/setenv-hdfs-12
|
|
chmod 755 $installdir/bin/setenv-hdfs-20
|
|
|
|
. $installdir/bin/setenv-hdfs-20
|
|
$installdir/bin/hdfsCheck $installdir/lib/hdfs-20.so > /tmp/hdfs-20-test.log 2>&1
|
|
if [ $? -eq 0 ]; then
|
|
#Passed set in config file
|
|
$installdir/bin/setConfig -d SystemConfig DataFilePlugin $installdir/lib/hdfs-20.so
|
|
$installdir/bin/setConfig -d SystemConfig DataFileEnvFile setenv-hdfs-20
|
|
|
|
#check for non-root user
|
|
if [ $installdir != "/usr/local/MariaDB/Columnstore" -a $quiet -eq 0 ]; then
|
|
cat <<EOD
|
|
|
|
If you are intending to install InfiniDB over Hadoop, the next steps are:
|
|
|
|
export INFINIDB_INSTALL_DIR=$installdir
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib:$installdir/mysql/lib/mysql
|
|
. $installdir/bin/setenv-hdfs-20
|
|
$installdir/bin/postConfigure -i $installdir
|
|
|
|
If you are intending to install InfiniDB without Hadoop, the next steps are:
|
|
|
|
export INFINIDB_INSTALL_DIR=$installdir
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib:$installdir/mysql/lib/mysql
|
|
$installdir/bin/postConfigure -i $installdir
|
|
|
|
EOD
|
|
else
|
|
cat <<EOD
|
|
|
|
If you are intending to install InfiniDB over Hadoop, the next steps are:
|
|
|
|
. $installdir/bin/setenv-hdfs-20
|
|
$installdir/bin/postConfigure
|
|
|
|
If you are intending to install InfiniDB without Hadoop, the next step is:
|
|
|
|
$installdir/bin/postConfigure
|
|
|
|
EOD
|
|
fi
|
|
else
|
|
. $installdir/bin/setenv-hdfs-12
|
|
$installdir/bin/hdfsCheck $installdir/lib/hdfs-12.so > /tmp/hdfs-12-test.log 2>&1
|
|
if [ $? -eq 0 ]; then
|
|
#Passed set in config file
|
|
$installdir/bin/setConfig -d SystemConfig DataFilePlugin $installdir/lib/hdfs-12.so
|
|
$installdir/bin/setConfig -d SystemConfig DataFileEnvFile setenv-hdfs-12
|
|
|
|
if [ $installdir != "/usr/local/MariaDB/Columnstore" -a $quiet -eq 0 ]; then
|
|
cat <<EOD
|
|
|
|
If you are intending to install InfiniDB over Hadoop, the next steps are:
|
|
|
|
export INFINIDB_INSTALL_DIR=$installdir
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib:$installdir/mysql/lib/mysql:$libpath
|
|
. $installdir/bin/setenv-hdfs-12
|
|
$installdir/bin/postConfigure -i $installdir
|
|
|
|
If you are intending to install InfiniDB without Hadoop, the next steps are:
|
|
|
|
export INFINIDB_INSTALL_DIR=$installdir
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib:$installdir/mysql/lib/mysql
|
|
$installdir/bin/postConfigure -i $installdir
|
|
|
|
EOD
|
|
else
|
|
cat <<EOD
|
|
|
|
If you are intending to install InfiniDB over Hadoop, the next steps are:
|
|
|
|
. $installdir/bin/setenv-hdfs-12
|
|
$installdir/bin/postConfigure
|
|
|
|
If you are intending to install InfiniDB without Hadoop, the next step is:
|
|
|
|
$installdir/bin/postConfigure
|
|
|
|
EOD
|
|
fi
|
|
else
|
|
cat <<EOD
|
|
|
|
If you are intending to install InfiniDB over Hadoop, the Hadoop sanity check did not pass.
|
|
Most likely there is an environment setup conflict or the hdfs services are down.
|
|
Please Contact InfiniDB Customer Support.
|
|
EOD
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
exit 0
|
|
|