[MySQL]: Instance Manager

MySQL Instance Manager

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

Using mysqld_multi for Managing Multiple MySQL Servers

mysqld_multi is designed to manage several mysqld processes that listen for connections on different Unix socket files and TCP/IP ports. It can start or stop servers, or report their current status.

mysqld_multi searches for groups named [mysqldN] in my.cnf (or in the file named by the –config-file option). N can be any positive integer. This number is referred to in the following discussion as the option group number, or GNR.

  1. Initialize the new datadir.
  2. Change the option file.

 

Sample Option file is as below:

[mysqld_multi]

mysqld     = /usr/local/bin/mysqld_safe

mysqladmin = /usr/local/bin/mysqladmin

user       = multi_admin

password   = multipass

 

[mysqld2]

socket     = /tmp/mysql.sock2

port       = 3307

pid-file   = /usr/local/mysql/var2/hostname.pid2

datadir    = /usr/local/mysql/var2

language   = /usr/local/share/mysql/english

user       = john

[mysqld3]

socket     = /tmp/mysql.sock3

port       = 3308

pid-file   = /usr/local/mysql/var3/hostname.pid3

datadir    = /usr/local/mysql/var3

language   = /usr/local/share/mysql/swedish

user       = monty

 

To invoke mysqld_multi, use the following syntax:

shell> mysqld_multi [options] {start|stop|report} [GNR[,GNR] …]

start, stop, and report indicate which operation to perform. You can perform the designated operation for a single server or multiple servers, depending on the GNR list that follows the option name. If there is no list, mysqld_multi performs the operation for all servers in the option file.

Each GNR value represents an option group number or range of group numbers. The value should be the number at the end of the group name in the option file. For example, the GNR for a group named [mysqld17] is 17. To specify a range of numbers, separate the first and last numbers by a dash. The GNR value 10-13 represents groups [mysqld10] through [mysqld13]. Multiple groups or group ranges can be specified on the command line, separated by commas.

 

This command starts a single server using option group [mysqld17]:

shell> mysqld_multi start 17

This command stops several servers, using option groups [mysqld8] and [mysqld10] through [mysqld13]:

shell> mysqld_multi stop 8,10-13

For an example of how you might set up an option file, use this command:

shell> mysqld_multi –example

 

Options:

 

–example                       Display a sample option file.

–mysqladmin=prog_name      The mysqladmin binary to be used to stop servers.

–mysqld=prog_name    The mysqld binary to be used.

–password=password   The password of the MySQL account to use when invoking mysqladmin.

–user=user_name                   The user name of the MySQL account to use when invoking mysqladmin.

 

 

  • Ask Question