From: Prabhat Kumar Date: May 11 2010 6:24am Subject: Re: starting multiple instances with mysqld_multi List-Archive: http://lists.mysql.com/mysql/221546 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=0016362835188fe2bf04864b9351 --0016362835188fe2bf04864b9351 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, You can run multiple instances on the same host and specify configuration options either by adding the options as arguments on the command line, or b= y storing them in configuration files. for example, from the command line: shell> mysqld --port 3306 --log=3D/path/to/server1/log shell> mysqld --port 3307 --log=3D/path/to/server2/log So, when MySQL starts up it reads various config files in sequence. This means that you can set global options for all instances in one file and the= n specific options for individual instances in separate files. The files it reads by default are (on linux) /etc/my.cnf > the_mysql_data_dir/my.cnf > ~/.my.cnf > You can direct the server to read specific config files after it reads the default /etc/my.cnf file with the following directive. --defaults-extra-file=3D/path/to/extra/config/file So, if you wanted 2 instances running with some shared options and some specific options, you could create additional configuration files in /etc say: /etc/my.server1.cnf /etc/my.server2.cnf where my.server1.cnf has the following lines: port=3D3306 log=3D/path/to/log/file/for/server1 (other options here) and my.server2.cnf is: port=3D3307 log=3D/path/to/log/file/for/server2 (other options here) then you could start the separate instances of mysqld as follows: shell> mysqld --defaults-extra-file=3D/etc/my.server1.cnf shell> mysqld --defaults-extra-file=3D/etc/my.server2.cnf about *mysqld_multi* > *mysqld_multi* > mysqld_multi [ options] {start| stop| report} [ server_id] > Use this to run multiple MySQL servers on different socket files and port= s. > To set up > multiple servers, a different section of server options must be entered > into a configuration file (e.g., /etc/my.cnf). The naming scheme for each > section must be [mysqldn] > where n is a different number for each server. Options must be entered > separately for > each server in its own section, even when servers use the same options. A= t > a minimum, > each server should use a different socket file and a different TCP/IP por= t. > To see an > example of how a configuration file might be set up for multiple servers, > enter the > following from the command line: > mysqld_multi --example > Once multiple servers have been configured, to start a server, you can > enter something > like the following from the command line: > mysqld_multi start 3 > This line would start server number 3 listed in the configuration file as > [mysqld3]. By > entering report for the first argument, you can obtain the status on the > server. For > starting and stopping the server, this script uses the mysqladmin utility= . > Here is an > alphabetical list of options specific to mysqld_multi that you can enter > from the > command line, along with a brief explanation of each: > --config-file=3Dfilename > Specifies the path and name of the server=92s configuration file if it is > different from > the default. > --example > Displays a sample configuration file. > --help > Displays basic help information. > --log=3Dfilename > Sets the path and name of the logfile. The default is > /tmp/mysqld_multi.log. > --mysqladmin=3Dpath > Sets the path to the mysqladmin utility. > --mysqld=3Dpath > Specifies the path to mysqld. > --no-log > Instructs the utility not to save messages to a log, but to send them to > stdout > instead. > --password=3Dpassword > Provides the password for using mysqladmin. > --tcp-ip > Enables TCP/IP communication with the server instead of using a Unix-doma= in > socket. > --user=3Duser > Provides the username for using mysqladmin. The same user must be used fo= r > all > servers. > --version > Displays the version of the utility. > Thanks, On Tue, May 11, 2010 at 9:54 AM, Nitin Mehta wrote: > Hi, > > I am exploring multiple instances with MySQL which will be running using > the same set of binaries (single MySQL base). Two things which I'm not ab= le > to work out are - > > 1. Why mysqld_multi stop doesn't work? Well, I know why i= t > doesn't because there is nothing in the script to handle a 'stop' call; t= he > actual question would be - why it doesn't work when it is mentioned in th= e > MySQL reference manual? > 2. how to (auto) restart the instances after a server restart? do = I > need to write my own script for this or is there anything available which > I'm not aware of? > If you have resolved these issues, please let me know. > > > Best Regards, > Nitin > > > --=20 Best Regards, Prabhat Kumar MySQL DBA Datavail-India Mumbai Mobile : 91-9987681929 www.datavail.com My Blog: http://adminlinux.blogspot.com My LinkedIn: http://www.linkedin.com/in/profileprabhat --0016362835188fe2bf04864b9351--