MySQL 5.0 Reference Manual  /  ...  /  mysqlmanager — The MySQL Instance Manager

4.6.10 mysqlmanager — The MySQL Instance Manager


MySQL Instance Manager is been deprecated in MySQL 5.1 and is removed in MySQL 5.5.

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
  Posted by Fredrik K on January 14, 2010
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.

# 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".
set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}

# Variables
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
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 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

if $DAEMON --defaults-file=$CONF; then
log_end_msg 0
log_end_msg 1
log_warning_msg "Please take a look at the syslog."
exit 1

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

pid=`cat $PID_FILE`
kill $pid

# 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
sleep 1

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

log_end_msg 0

set +e; $SELF stop; set -e
$SELF start

echo "Usage: $SELF start|stop|restart|force-reload"
exit 1

Sign Up Login You must be logged in to post a comment.