You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
add mysql-Calpont back in
This commit is contained in:
@ -349,7 +349,7 @@ rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/%{name}-%{version}-%{release}
|
|||||||
/usr/local/Calpont/lib/libcalmysql.so.1.0.0
|
/usr/local/Calpont/lib/libcalmysql.so.1.0.0
|
||||||
/usr/local/Calpont/lib/libudf_mysql.so.1.0.0
|
/usr/local/Calpont/lib/libudf_mysql.so.1.0.0
|
||||||
|
|
||||||
#/usr/local/Calpont/mysql/mysql-Calpont
|
/usr/local/Calpont/mysql/mysql-Calpont
|
||||||
/usr/local/Calpont/mysql/install_calpont_mysql.sh
|
/usr/local/Calpont/mysql/install_calpont_mysql.sh
|
||||||
/usr/local/Calpont/mysql/syscatalog_mysql.sql
|
/usr/local/Calpont/mysql/syscatalog_mysql.sql
|
||||||
/usr/local/Calpont/mysql/dumpcat_mysql.sql
|
/usr/local/Calpont/mysql/dumpcat_mysql.sql
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
|
||||||
# $Id: mysql-Calpont 9604 2013-06-05 15:56:49Z dhill $
|
|
||||||
#
|
|
||||||
|
|
||||||
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
|
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
|
||||||
# This file is public domain and comes with NO WARRANTY of any kind
|
# This file is public domain and comes with NO WARRANTY of any kind
|
||||||
|
|
||||||
@ -29,8 +24,8 @@
|
|||||||
# Short-Description: start and stop MySQL
|
# Short-Description: start and stop MySQL
|
||||||
# Description: MySQL is a very fast and reliable SQL database engine.
|
# Description: MySQL is a very fast and reliable SQL database engine.
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
# If you install MySQL on some other places than /, then you
|
# If you install MySQL on some other places than /usr/local/Calpont/mysql, then you
|
||||||
# have to do one of the following things for this script to work:
|
# have to do one of the following things for this script to work:
|
||||||
#
|
#
|
||||||
# - Run this script from within the MySQL installation directory
|
# - Run this script from within the MySQL installation directory
|
||||||
@ -48,47 +43,34 @@
|
|||||||
# If you change base dir, you must also change datadir. These may get
|
# If you change base dir, you must also change datadir. These may get
|
||||||
# overwritten by settings in the MySQL configuration files.
|
# overwritten by settings in the MySQL configuration files.
|
||||||
|
|
||||||
if [ -z "$INFINIDB_INSTALL_DIR" ]; then
|
basedir=/usr/local/Calpont/mysql
|
||||||
test -f /etc/default/infinidb && . /etc/default/infinidb
|
datadir=/usr/local/Calpont/mysql/db
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$INFINIDB_INSTALL_DIR" ]; then
|
|
||||||
INFINIDB_INSTALL_DIR=/usr/local/Calpont
|
|
||||||
SUDO=
|
|
||||||
else
|
|
||||||
SUDO="sudo"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export INFINIDB_INSTALL_DIR=$INFINIDB_INSTALL_DIR
|
|
||||||
|
|
||||||
basedir=$INFINIDB_INSTALL_DIR/mysql
|
|
||||||
datadir=$basedir/db
|
|
||||||
|
|
||||||
# Default value, in seconds, afterwhich the script should timeout waiting
|
# Default value, in seconds, afterwhich the script should timeout waiting
|
||||||
# for server start.
|
# for server start.
|
||||||
# Value here is overriden by value in my.cnf.
|
# Value here is overriden by value in my.cnf.
|
||||||
# 0 means don't wait at all
|
# 0 means don't wait at all
|
||||||
# Negative numbers mean to wait indefinitely
|
# Negative numbers mean to wait indefinitely
|
||||||
service_startup_timeout=30
|
service_startup_timeout=900
|
||||||
service_shutdown_timeout=3
|
|
||||||
|
# Lock directory for RedHat / SuSE.
|
||||||
|
lockdir='/var/lock/subsys'
|
||||||
|
lock_file_path="$lockdir/mysql"
|
||||||
|
|
||||||
# The following variables are only set for letting mysql.server find things.
|
# The following variables are only set for letting mysql.server find things.
|
||||||
|
|
||||||
# Set some defaults
|
# Set some defaults
|
||||||
pid_file=
|
mysqld_pid_file_path=
|
||||||
server_pid_file=
|
|
||||||
use_mysqld_safe=1
|
|
||||||
user=mysql
|
|
||||||
if test -z "$basedir"
|
if test -z "$basedir"
|
||||||
then
|
then
|
||||||
basedir=/
|
basedir=/usr/local/Calpont/mysql
|
||||||
bindir=/usr/bin
|
bindir=/usr/local/bin
|
||||||
if test -z "$datadir"
|
if test -z "$datadir"
|
||||||
then
|
then
|
||||||
datadir=/var/lib/mysql
|
datadir=/var/lib/mysql
|
||||||
fi
|
fi
|
||||||
sbindir=/usr/sbin
|
sbindir=/usr/local/sbin
|
||||||
libexecdir=/usr/sbin
|
libexecdir=/usr/local/sbin
|
||||||
else
|
else
|
||||||
bindir="$basedir/bin"
|
bindir="$basedir/bin"
|
||||||
if test -z "$datadir"
|
if test -z "$datadir"
|
||||||
@ -96,7 +78,12 @@ else
|
|||||||
datadir="$basedir/data"
|
datadir="$basedir/data"
|
||||||
fi
|
fi
|
||||||
sbindir="$basedir/sbin"
|
sbindir="$basedir/sbin"
|
||||||
libexecdir="$basedir/libexec"
|
if test -f "$basedir/sbin/mysqld"
|
||||||
|
then
|
||||||
|
libexecdir="$basedir/sbin"
|
||||||
|
else
|
||||||
|
libexecdir="$basedir/libexec"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# datadir_set is used to determine if datadir was set (and so should be
|
# datadir_set is used to determine if datadir was set (and so should be
|
||||||
@ -110,6 +97,11 @@ lsb_functions="/lib/lsb/init-functions"
|
|||||||
if test -f $lsb_functions ; then
|
if test -f $lsb_functions ; then
|
||||||
. $lsb_functions
|
. $lsb_functions
|
||||||
else
|
else
|
||||||
|
# Include non-LSB RedHat init functions to make systemctl redirect work
|
||||||
|
init_functions="/etc/init.d/functions"
|
||||||
|
if test -f $init_functions; then
|
||||||
|
. $init_functions
|
||||||
|
fi
|
||||||
log_success_msg()
|
log_success_msg()
|
||||||
{
|
{
|
||||||
echo " SUCCESS! $@"
|
echo " SUCCESS! $@"
|
||||||
@ -120,15 +112,12 @@ else
|
|||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
|
PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
mode=$1 # start or stop
|
mode=$1 # start or stop
|
||||||
shift
|
|
||||||
other_args="$*" # uncommon, but needed when called from an RPM upgrade action
|
[ $# -ge 1 ] && shift
|
||||||
# Expected: "--skip-networking --skip-grant-tables"
|
|
||||||
# They are not checked here, intentionally, as it is the resposibility
|
|
||||||
# of the "spec" file author to give correct arguments only.
|
|
||||||
|
|
||||||
case `echo "testing\c"`,`echo -n testing` in
|
case `echo "testing\c"`,`echo -n testing` in
|
||||||
*c*,-n*) echo_n= echo_c= ;;
|
*c*,-n*) echo_n= echo_c= ;;
|
||||||
@ -145,116 +134,26 @@ parse_server_arguments() {
|
|||||||
datadir="$basedir/data"
|
datadir="$basedir/data"
|
||||||
fi
|
fi
|
||||||
sbindir="$basedir/sbin"
|
sbindir="$basedir/sbin"
|
||||||
libexecdir="$basedir/libexec"
|
if test -f "$basedir/sbin/mysqld"
|
||||||
|
then
|
||||||
|
libexecdir="$basedir/sbin"
|
||||||
|
else
|
||||||
|
libexecdir="$basedir/libexec"
|
||||||
|
fi
|
||||||
|
#libexecdir="$basedir/libexec"
|
||||||
;;
|
;;
|
||||||
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
|
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
|
||||||
datadir_set=1
|
datadir_set=1
|
||||||
;;
|
;;
|
||||||
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
--log-basename=*|--hostname=*|--loose-log-basename=*)
|
||||||
--pid-file=*) server_pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
mysqld_pid_file_path=`echo "$arg.pid" | sed -e 's/^[^=]*=//'`
|
||||||
|
;;
|
||||||
|
--pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
||||||
--service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
--service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
||||||
--use-mysqld_safe) use_mysqld_safe=1;;
|
|
||||||
--use-manager) use_mysqld_safe=0;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_manager_arguments() {
|
|
||||||
for arg do
|
|
||||||
case "$arg" in
|
|
||||||
--pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
|
||||||
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
wait_for_pid () {
|
|
||||||
verb="$1"
|
|
||||||
manager_pid="$2" # process ID of the program operating on the pid-file
|
|
||||||
i=0
|
|
||||||
avoid_race_condition="by checking again"
|
|
||||||
|
|
||||||
case "$verb" in
|
|
||||||
'created')
|
|
||||||
timeout=$service_startup_timeout
|
|
||||||
;;
|
|
||||||
'removed')
|
|
||||||
timeout=$service_shutdown_timeout
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
timeout=$service_startup_timeout
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
while test $i -ne $timeout ; do
|
|
||||||
|
|
||||||
case "$verb" in
|
|
||||||
'created')
|
|
||||||
# wait for a PID-file to pop into existence.
|
|
||||||
test -s $pid_file && i='' && break
|
|
||||||
;;
|
|
||||||
'removed')
|
|
||||||
# wait for this PID-file to disappear
|
|
||||||
test ! -s $pid_file && i='' && break
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "wait_for_pid () usage: wait_for_pid created|removed manager_pid"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# if manager isn't running, then pid-file will never be updated
|
|
||||||
if test -n "$manager_pid"; then
|
|
||||||
if kill -0 "$manager_pid" 2>/dev/null; then
|
|
||||||
: # the manager still runs
|
|
||||||
else
|
|
||||||
# The manager may have exited between the last pid-file check and now.
|
|
||||||
if test -n "$avoid_race_condition"; then
|
|
||||||
avoid_race_condition=""
|
|
||||||
continue # Check again.
|
|
||||||
fi
|
|
||||||
|
|
||||||
kill_by_pid
|
|
||||||
# there's nothing that will affect the file.
|
|
||||||
log_failure_msg "Manager of pid-file quit without updating file."
|
|
||||||
return 1 # not waiting any more.
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $echo_n ".$echo_c"
|
|
||||||
i=`expr $i + 1`
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
if test -z "$i" ; then
|
|
||||||
log_success_msg
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
log_failure_msg
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
kill_by_pid() {
|
|
||||||
# let's see if we can kill the 2 mysql procs by hand
|
|
||||||
# get the our mysql from ps
|
|
||||||
eval $(ps -ef | grep "$INFINIDB_INSTALL_DIR/mysql/libexec/mysqld" | grep -v grep | head -1 | awk '{printf "pid=%d\n", $2}')
|
|
||||||
|
|
||||||
if [ -n "$pid" ]; then
|
|
||||||
ppid=$(ps -o ppid= -p $pid)
|
|
||||||
$SUDO kill -9 $ppid
|
|
||||||
kill -9 $ppid
|
|
||||||
sleep 1
|
|
||||||
$SUDO kill -9 $pid
|
|
||||||
kill -9 $pid
|
|
||||||
echo $echo_n "Force shutting down (no/bad pid file)"
|
|
||||||
log_success_msg
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get arguments from the my.cnf file,
|
# Get arguments from the my.cnf file,
|
||||||
# the only group, which is read from now on is [mysqld]
|
# the only group, which is read from now on is [mysqld]
|
||||||
if test -x ./bin/my_print_defaults
|
if test -x ./bin/my_print_defaults
|
||||||
@ -268,7 +167,7 @@ then
|
|||||||
print_defaults="$bindir/mysql_print_defaults"
|
print_defaults="$bindir/mysql_print_defaults"
|
||||||
else
|
else
|
||||||
# Try to find basedir in /etc/my.cnf
|
# Try to find basedir in /etc/my.cnf
|
||||||
conf=$basedir/mysql/my.cnf
|
conf=/etc/my.cnf
|
||||||
print_defaults=
|
print_defaults=
|
||||||
if test -r $conf
|
if test -r $conf
|
||||||
then
|
then
|
||||||
@ -302,109 +201,125 @@ fi
|
|||||||
extra_args=""
|
extra_args=""
|
||||||
if test -r "$basedir/my.cnf"
|
if test -r "$basedir/my.cnf"
|
||||||
then
|
then
|
||||||
extra_args="-c $basedir/my.cnf"
|
extra_args="-e $basedir/my.cnf"
|
||||||
else
|
else
|
||||||
if test -r "$datadir/my.cnf"
|
if test -r "$datadir/my.cnf"
|
||||||
then
|
then
|
||||||
extra_args="-c $datadir/my.cnf"
|
extra_args="-e $datadir/my.cnf"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
|
parse_server_arguments `$print_defaults $extra_args --mysqld mysql.server`
|
||||||
|
parse_server_arguments "$@"
|
||||||
|
|
||||||
# Look for the pidfile
|
# wait for the pid file to disappear
|
||||||
parse_manager_arguments `$print_defaults $extra_args manager`
|
wait_for_gone () {
|
||||||
|
pid="$1" # process ID of the program operating on the pid-file
|
||||||
|
pid_file_path="$2" # path to the PID file.
|
||||||
|
|
||||||
|
i=0
|
||||||
|
crash_protection="by checking again"
|
||||||
|
|
||||||
|
while test $i -ne $service_startup_timeout ; do
|
||||||
|
|
||||||
|
if kill -0 "$pid" 2>/dev/null; then
|
||||||
|
: # the server still runs
|
||||||
|
else
|
||||||
|
if test ! -s "$pid_file_path"; then
|
||||||
|
# no server process and no pid-file? great, we're done!
|
||||||
|
log_success_msg
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pid-file exists, the server process doesn't.
|
||||||
|
# it must've crashed, and mysqld_safe will restart it
|
||||||
|
if test -n "$crash_protection"; then
|
||||||
|
crash_protection=""
|
||||||
|
sleep 5
|
||||||
|
continue # Check again.
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Cannot help it
|
||||||
|
log_failure_msg "The server quit without updating PID file ($pid_file_path)."
|
||||||
|
return 1 # not waiting any more.
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $echo_n ".$echo_c"
|
||||||
|
i=`expr $i + 1`
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
log_failure_msg
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_ready () {
|
||||||
|
|
||||||
|
i=0
|
||||||
|
while test $i -ne $service_startup_timeout ; do
|
||||||
|
|
||||||
|
if $bindir/mysqladmin ping --socket=/usr/local/Calpont/mysql/lib/mysql/mysql.sock >/dev/null 2>&1; then
|
||||||
|
log_success_msg
|
||||||
|
return 0
|
||||||
|
elif kill -0 $! 2>/dev/null ; then
|
||||||
|
: # mysqld_safe is still running
|
||||||
|
else
|
||||||
|
# mysqld_safe is no longer running, abort the wait loop
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $echo_n ".$echo_c"
|
||||||
|
i=`expr $i + 1`
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
log_failure_msg
|
||||||
|
return 1
|
||||||
|
}
|
||||||
#
|
#
|
||||||
# Set pid file if not given
|
# Set pid file if not given
|
||||||
#
|
#
|
||||||
if test -z "$pid_file"
|
if test -z "$mysqld_pid_file_path"
|
||||||
then
|
then
|
||||||
pid_file=$datadir/mysqlmanager-`/bin/hostname`.pid
|
mysqld_pid_file_path=$datadir/`hostname`.pid
|
||||||
else
|
else
|
||||||
case "$pid_file" in
|
case "$mysqld_pid_file_path" in
|
||||||
/* ) ;;
|
/* ) ;;
|
||||||
* ) pid_file="$datadir/$pid_file" ;;
|
* ) mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;;
|
||||||
esac
|
|
||||||
fi
|
|
||||||
if test -z "$server_pid_file"
|
|
||||||
then
|
|
||||||
server_pid_file=$datadir/`/bin/hostname`.pid
|
|
||||||
else
|
|
||||||
case "$server_pid_file" in
|
|
||||||
/* ) ;;
|
|
||||||
* ) server_pid_file="$datadir/$server_pid_file" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# source other config files
|
||||||
|
[ -f /etc/default/mysql ] && . /etc/default/mysql
|
||||||
|
[ -f /etc/sysconfig/mysql ] && . /etc/sysconfig/mysql
|
||||||
|
[ -f /etc/conf.d/mysql ] && . /etc/conf.d/mysql
|
||||||
|
|
||||||
case "$mode" in
|
case "$mode" in
|
||||||
'start')
|
'start')
|
||||||
if [ -f /var/lock/subsys/mysql-Calpont ]; then
|
|
||||||
echo "InfiniDB MySQL already running"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start daemon
|
# Start daemon
|
||||||
|
|
||||||
# Safeguard (relative paths, core dumps..)
|
# Safeguard (relative paths, core dumps..)
|
||||||
cd $basedir
|
cd $basedir
|
||||||
|
|
||||||
manager=$bindir/mysqlmanager
|
|
||||||
if test -x $libexecdir/mysqlmanager
|
|
||||||
then
|
|
||||||
manager=$libexecdir/mysqlmanager
|
|
||||||
elif test -x $sbindir/mysqlmanager
|
|
||||||
then
|
|
||||||
manager=$sbindir/mysqlmanager
|
|
||||||
fi
|
|
||||||
|
|
||||||
# @bug 2104. remove all left over vtables. Look for @0024vtable ($vtable).
|
|
||||||
# "@0024vtable" is a reserved word of InfiniDB and can not be used in regular user table name.
|
|
||||||
cd db
|
|
||||||
find . -name '@0024vtable*' | xargs /bin/rm -f
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# hook for InfiniDB automated testing
|
|
||||||
test -x /usr/local/bin/idb-testing-mysql-pre-start && /usr/local/bin/idb-testing-mysql-pre-start $basedir
|
|
||||||
|
|
||||||
echo $echo_n "Starting MySQL"
|
echo $echo_n "Starting MySQL"
|
||||||
if test -x $manager -a "$use_mysqld_safe" = "0"
|
if test -x $bindir/mysqld_safe
|
||||||
then
|
|
||||||
if test -n "$other_args"
|
|
||||||
then
|
|
||||||
log_failure_msg "MySQL manager does not support options '$other_args'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Give extra arguments to mysqld with the my.cnf file. This script may
|
|
||||||
# be overwritten at next upgrade.
|
|
||||||
"$manager" \
|
|
||||||
--mysqld-safe-compatible \
|
|
||||||
--user="$user" \
|
|
||||||
--pid-file="$pid_file" >/dev/null 2>&1 &
|
|
||||||
wait_for_pid created $!; return_value=$?
|
|
||||||
|
|
||||||
# Make lock for RedHat / SuSE
|
|
||||||
if test -w /var/lock/subsys
|
|
||||||
then
|
|
||||||
touch /var/lock/subsys/mysqlmanager-Calpont
|
|
||||||
fi
|
|
||||||
exit $return_value
|
|
||||||
elif test -x $bindir/mysqld_safe
|
|
||||||
then
|
then
|
||||||
# Give extra arguments to mysqld with the my.cnf file. This script
|
# Give extra arguments to mysqld with the my.cnf file. This script
|
||||||
# may be overwritten at next upgrade.
|
# may be overwritten at next upgrade.
|
||||||
pid_file=$server_pid_file
|
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "--ledir=$libexecdir" "$@" >/dev/null 2>&1 &
|
||||||
$bindir/mysqld_safe --defaults-file=$basedir/my.cnf --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
|
wait_for_ready; return_value=$?
|
||||||
wait_for_pid created $!; return_value=$?
|
|
||||||
|
|
||||||
# Make lock for RedHat / SuSE
|
# Make lock for RedHat / SuSE
|
||||||
if test -w /var/lock/subsys
|
if test -w "$lockdir"
|
||||||
then
|
then
|
||||||
touch /var/lock/subsys/mysql-Calpont
|
touch "$lock_file_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit $return_value
|
exit $return_value
|
||||||
else
|
else
|
||||||
log_failure_msg "Couldn't find MySQL manager ($manager) or server ($bindir/mysqld_safe)"
|
log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -412,52 +327,40 @@ case "$mode" in
|
|||||||
# Stop daemon. We use a signal here to avoid having to know the
|
# Stop daemon. We use a signal here to avoid having to know the
|
||||||
# root password.
|
# root password.
|
||||||
|
|
||||||
# The RedHat / SuSE lock directory to remove
|
if test -s "$mysqld_pid_file_path"
|
||||||
lock_dir=/var/lock/subsys/mysqlmanager-Calpont
|
|
||||||
|
|
||||||
# If the manager pid_file doesn't exist, try the server's
|
|
||||||
if test ! -s "$pid_file"
|
|
||||||
then
|
then
|
||||||
pid_file=$server_pid_file
|
mysqld_pid=`cat "$mysqld_pid_file_path"`
|
||||||
lock_dir=/var/lock/subsys/mysql-Calpont
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -s "$pid_file"
|
if (kill -0 $mysqld_pid 2>/dev/null)
|
||||||
then
|
then
|
||||||
mysqlmanager_pid=`cat $pid_file`
|
echo $echo_n "Shutting down MySQL"
|
||||||
echo $echo_n "Shutting down MySQL"
|
kill $mysqld_pid
|
||||||
$SUDO kill $mysqlmanager_pid
|
# mysqld should remove the pid file when it exits, so wait for it.
|
||||||
kill $mysqlmanager_pid
|
wait_for_gone $mysqld_pid "$mysqld_pid_file_path"; return_value=$?
|
||||||
# mysqlmanager should remove the pid_file when it exits, so wait for it.
|
else
|
||||||
wait_for_pid removed "$mysqlmanager_pid"
|
log_failure_msg "MySQL server process #$mysqld_pid is not running!"
|
||||||
|
rm "$mysqld_pid_file_path"
|
||||||
# @bug2639. force kill mysqld and mysqld_safe after timeout
|
fi
|
||||||
$SUDO kill -9 $(ps -efl|awk "{if (\$4==$mysqlmanager_pid) print \$5}") &>/dev/null
|
|
||||||
kill -9 $(ps -efl|awk "{if (\$4==$mysqlmanager_pid) print \$5}") &>/dev/null
|
# Delete lock for RedHat / SuSE
|
||||||
$SUDO kill -9 $mysqlmanager_pid &>/dev/null
|
if test -f "$lock_file_path"
|
||||||
kill -9 $mysqlmanager_pid &>/dev/null
|
then
|
||||||
log_success_msg
|
rm -f "$lock_file_path"
|
||||||
|
fi
|
||||||
|
exit $return_value
|
||||||
else
|
else
|
||||||
kill_by_pid
|
log_failure_msg "MySQL server PID file could not be found!"
|
||||||
log_failure_msg "MySQL manager or server PID file could not be found!"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# delete lock for RedHat / SuSE
|
|
||||||
if test -f $lock_dir
|
|
||||||
then
|
|
||||||
rm -f $lock_dir
|
|
||||||
fi
|
|
||||||
|
|
||||||
# hook for InfiniDB automated testing
|
|
||||||
test -x /usr/local/bin/idb-testing-mysql-post-stop && /usr/local/bin/idb-testing-mysql-post-stop $basedir
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'restart')
|
'restart')
|
||||||
# Stop the service and regardless of whether it was
|
# Stop the service and regardless of whether it was
|
||||||
# running or not, start it again.
|
# running or not, start it again.
|
||||||
if $0 stop $other_args; then
|
if $0 stop "$@"; then
|
||||||
$0 start $other_args
|
if ! $0 start "$@"; then
|
||||||
|
log_failure_msg "Failed to restart server."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
log_failure_msg "Failed to stop running server, so refusing to try to start."
|
log_failure_msg "Failed to stop running server, so refusing to try to start."
|
||||||
exit 1
|
exit 1
|
||||||
@ -465,10 +368,10 @@ case "$mode" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
'reload'|'force-reload')
|
'reload'|'force-reload')
|
||||||
if test -s "$server_pid_file" ; then
|
if test -s "$mysqld_pid_file_path" ; then
|
||||||
read mysqld_pid < $server_pid_file
|
read mysqld_pid < "$mysqld_pid_file_path"
|
||||||
kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
|
kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
|
||||||
touch $server_pid_file
|
touch "$mysqld_pid_file_path"
|
||||||
else
|
else
|
||||||
log_failure_msg "MySQL PID file could not be found!"
|
log_failure_msg "MySQL PID file could not be found!"
|
||||||
exit 1
|
exit 1
|
||||||
@ -476,8 +379,8 @@ case "$mode" in
|
|||||||
;;
|
;;
|
||||||
'status')
|
'status')
|
||||||
# First, check to see if pid file exists
|
# First, check to see if pid file exists
|
||||||
if test -s "$server_pid_file" ; then
|
if test -s "$mysqld_pid_file_path" ; then
|
||||||
read mysqld_pid < $server_pid_file
|
read mysqld_pid < "$mysqld_pid_file_path"
|
||||||
if kill -0 $mysqld_pid 2>/dev/null ; then
|
if kill -0 $mysqld_pid 2>/dev/null ; then
|
||||||
log_success_msg "MySQL running ($mysqld_pid)"
|
log_success_msg "MySQL running ($mysqld_pid)"
|
||||||
exit 0
|
exit 0
|
||||||
@ -488,27 +391,67 @@ case "$mode" in
|
|||||||
else
|
else
|
||||||
# Try to find appropriate mysqld process
|
# Try to find appropriate mysqld process
|
||||||
mysqld_pid=`pidof $libexecdir/mysqld`
|
mysqld_pid=`pidof $libexecdir/mysqld`
|
||||||
if test -z $mysqld_pid ; then
|
|
||||||
if test "$use_mysqld_safe" = "0" ; then
|
# test if multiple pids exist
|
||||||
lockfile=/var/lock/subsys/mysqlmanager-Calpont
|
pid_count=`echo $mysqld_pid | wc -w`
|
||||||
else
|
if test $pid_count -gt 1 ; then
|
||||||
lockfile=/var/lock/subsys/mysql-Calpont
|
log_failure_msg "Multiple MySQL running but PID file could not be found ($mysqld_pid)"
|
||||||
fi
|
exit 5
|
||||||
if test -f $lockfile ; then
|
elif test -z $mysqld_pid ; then
|
||||||
log_failure_msg "MySQL is not running, but lock exists"
|
if test -f "$lock_file_path" ; then
|
||||||
|
log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
log_failure_msg "MySQL is not running"
|
log_failure_msg "MySQL is not running"
|
||||||
exit 3
|
exit 3
|
||||||
else
|
else
|
||||||
log_failure_msg "MySQL running but PID file could not be found"
|
log_failure_msg "MySQL is running but PID file could not be found"
|
||||||
exit 4
|
exit 4
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
'configtest')
|
||||||
|
# Safeguard (relative paths, core dumps..)
|
||||||
|
cd $basedir
|
||||||
|
echo $echo_n "Testing MySQL configuration syntax"
|
||||||
|
daemon=$bindir/mysqld
|
||||||
|
if test -x $libexecdir/mysqld
|
||||||
|
then
|
||||||
|
daemon=$libexecdir/mysqld
|
||||||
|
elif test -x $sbindir/mysqld
|
||||||
|
then
|
||||||
|
daemon=$sbindir/mysqld
|
||||||
|
elif test -x `which mysqld`
|
||||||
|
then
|
||||||
|
daemon=`which mysqld`
|
||||||
|
else
|
||||||
|
log_failure_msg "Unable to locate the mysqld binary!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
help_out=`$daemon --help 2>&1`; r=$?
|
||||||
|
if test "$r" != 0 ; then
|
||||||
|
log_failure_msg "$help_out"
|
||||||
|
log_failure_msg "There are syntax errors in the server configuration. Please fix them!"
|
||||||
|
else
|
||||||
|
log_success_msg "Syntax OK"
|
||||||
|
fi
|
||||||
|
exit $r
|
||||||
|
;;
|
||||||
|
'bootstrap')
|
||||||
|
if test "$_use_systemctl" == 1 ; then
|
||||||
|
log_failure_msg "Please use galera_new_cluster to start the mariadb service with --wsrep-new-cluster"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Bootstrap the cluster, start the first node
|
||||||
|
# that initiate the cluster
|
||||||
|
echo $echo_n "Bootstrapping the cluster.. "
|
||||||
|
$0 start $other_args --wsrep-new-cluster
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
# usage
|
# usage
|
||||||
echo "Usage: $0 {start|stop|restart|reload|force-reload|status} [ MySQL server options ]"
|
basename=`basename "$0"`
|
||||||
|
echo "Usage: $basename {start|stop|restart|reload|force-reload|status|configtest|bootstrap} [ MySQL server options ]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Reference in New Issue
Block a user