[+/-]
MySQL Instance Manager is been deprecated in MySQL 5.1 and is removed in MySQL 5.4.
mysqlmanager is the MySQL Instance Manager (IM). This program monitors and manages MySQL Database Server instances. MySQL Instance Manager is available for Unix-like operating systems, and also on Windows as of MySQL 5.0.13. It runs as a daemon that listens on a TCP/IP port. On Unix, it also listens on a Unix socket file.
MySQL Instance Manager is included in MySQL distributions from
version 5.0.3, and can be used in place of the
mysqld_safe
script to start and stop one or
more instances of MySQL Server. Because Instance Manager can
manage multiple server instances, it can also be used in place
of the mysqld_multi script. Instance Manager
offers these capabilities:
Instance Manager can start and stop instances, and report on the status of instances.
Server instances can be treated as guarded or unguarded:
When Instance Manager starts, it starts each guarded instance. If the instance crashes, Instance Manager detects this and restarts it. When Instance Manager stops, it stops the instance.
A nonguarded instance is not started when Instance Manager starts or monitored by it. If the instance crashes after being started, Instance Manager does not restart it. When Instance Manager exits, it does not stop the instance if it is running.
Instances are guarded by default. An instance can be
designated as nonguarded by including the
nonguarded
option in the configuration
file.
Instance Manager provides an interactive interface for configuring instances, so that the need to edit the configuration file manually is reduced or eliminated.
Instance Manager provides remote instance management. That is, it runs on the host where you want to control MySQL Server instances, but you can connect to it from a remote host to perform instance-management operations.
The following sections describe MySQL Instance Manager operation in more detail.
User Comments
The debian version of mysqlmanager does not come with any init script. So I wrote my own based on the mysql-ndb script. It uses the pid-file to check if the mysqlmanager is running or not, so you have to update the script with the location of mysqlmanager pid-file.
It also assumes that you are running the mysqlmanager as a service (by using "run-as-service" in your config).
Feel free to use it or change it to fit your needs.
/etc/init.d/mysqlmanager:
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mysql-ndb-mgm
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $named $time
# Should-Stop: $network $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the mysqlmanager daemon
# Description: Controls the MySQL Manager daemon "mysqlmanager".
### END INIT INFO
#
set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
# Variables
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
DAEMON=/usr/sbin/mysqlmanager
CONF=/etc/mysql/my.cnf
PID_FILE=/var/run/mysqld/mysqlmanager.pid
export HOME=/etc/mysql/
# Safeguard (relative paths, core dumps..)
cd /
umask 077
# Exit *silently* if we're not supposed to be started.
#
# The Debian scripts should execute these scripts to stop and start
# the daemon when upgrading if it is started. On the other hand it should
# remain silently if the server has not even been configured.
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
test -x $DAEMON || exit 0
test -r $CONF || exit 0
. /lib/lsb/init-functions
#
# main()
#
case "${1:-''}" in
'start')
# Start daemon
log_daemon_msg "Starting MySQL Manager" "mysqlmanager"
if [ -f $PID_FILE ]; then
log_end_msg 0
log_warning_msg "MySQL Manager is already running."
exit 0
fi
if $DAEMON --defaults-file=$CONF; then
log_end_msg 0
else
log_end_msg 1
log_warning_msg "Please take a look at the syslog."
exit 1
fi
;;
'stop')
log_daemon_msg "Stopping MySQL Manager" "mysqlmanager"
if [ ! -f $PID_FILE ]; then
log_end_msg 0
log_warning_msg "MySQL Manager is not running."
exit 0
fi
pid=`cat $PID_FILE`
kill $pid
dead=""
# Give the mysqlmanager 10 seconds to stop. This might be too short time.
for seq in 1 2 3 4 5 6 7 8 9 10; do
if [ ! -f $PID_FILE ]; then
dead=1
break
fi
sleep 1
done
if [ -z "$dead" ]; then
# If we really want to stop the mysqlmanager we can do a "kill -9 $pid" here
log_end_msg 1
log_failure_msg "Failed to stop MySQL Manager."
exit 1
fi
log_end_msg 0
;;
'restart'|'force-reload')
set +e; $SELF stop; set -e
$SELF start
;;
*)
echo "Usage: $SELF start|stop|restart|force-reload"
exit 1
;;
esac
Add your own comment.