From: Nitin Mehta Date: May 11 2010 10:19am Subject: Re: starting multiple instances with mysqld_multi List-Archive: http://lists.mysql.com/mysql/221547 Message-Id: <697629.90226.qm@web57005.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1420454395-1273573160=:90226" --0-1420454395-1273573160=:90226 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thanks, Prabhat! You're very right, but did you read the questions I asked?= =0A=0A=0A=0A=0A=0A=0A________________________________=0AFrom: Prabhat Kumar= =0ATo: Nitin Mehta =0ACc: mysql@l= ists.mysql.com=0ASent: Tue, May 11, 2010 11:54:22 AM=0ASubject: Re: startin= g multiple instances with mysqld_multi=0A=0AHi,=0A=0AYou can run multiple i= nstances on the same host and specify configuration options either by addin= g the options as arguments on the command line, or by storing them in confi= guration files.=0A=0Afor example, from the command line:=0A=0Ashell> mysqld= --port 3306 --log=3D/path/to/server1/log=0Ashell> mysqld --port 3307 --log= =3D/path/to/server2/log=0A=0A=0ASo, when MySQL starts up it reads various c= onfig files in sequence. This means that you can set global options for all= instances in one file and then specific options for individual instances i= n separate files.=0A=0AThe files it reads by default are (on linux)=0A=0A= =0A>>/etc/my.cnf=0A>>the_mysql_data_dir/my.cnf=0A>>~/.my.cnf=0A>>=0AYou can= direct the server to read specific config files after it reads the default= /etc/my.cnf file with the following directive.=0A=0A--defaults-extra-file= =3D/path/to/extra/config/file=0A=0ASo, if you wanted 2 instances running wi= th some shared options and some specific options, you could create addition= al configuration files in /etc say:=0A=0A/etc/my.server1.cnf=0A/etc/my.serv= er2.cnf=0A=0Awhere my.server1.cnf has the following lines:=0A=0Aport=3D3306= =0Alog=3D/path/to/log/file/for/server1=0A(other options here)=0A=0Aand my.s= erver2.cnf is:=0A=0Aport=3D3307=0Alog=3D/path/to/log/file/for/server2=0A(ot= her options here)=0A=0Athen you could start the separate instances of mysql= d as follows:=0A=0Ashell> mysqld --defaults-extra-file=3D/etc/my.server1.cn= f=0Ashell> mysqld --defaults-extra-file=3D/etc/my.server2.cnf=0A=0Aabout my= sqld_multi=0Amysqld_multi=0A>>mysqld_multi [ options] {start| stop| report}= [ server_id]=0A>Use this to run multiple MySQL servers on different socket= files and ports. To set up=0A>multiple servers, a different section of ser= ver options must be entered into a configuration file (e.g., /etc/my.cnf). = The naming scheme for each section must be [mysqldn]=0A>>where n is a diffe= rent number for each server. Options must be entered separately for=0A>each= server in its own section, even when servers use the same options. At a mi= nimum,=0A>each server should use a different socket file and a different TC= P/IP port. To see an=0A>>example of how a configuration file might be set u= p for multiple servers, enter the=0A>following from the command line:=0A>my= sqld_multi --example=0A>Once multiple servers have been configured, to star= t a server, you can enter something=0A>>like the following from the command= line:=0A>mysqld_multi start 3=0A>This line would start server number 3 lis= ted in the configuration file as [mysqld3]. By=0A>entering report for the f= irst argument, you can obtain the status on the server. For=0A>>starting an= d stopping the server, this script uses the mysqladmin utility. Here is an= =0A>alphabetical list of options specific to mysqld_multi that you can ente= r from the=0A>command line, along with a brief explanation of each:=0A>>--c= onfig-file=3Dfilename=0A>Specifies the path and name of the server=E2=80=99= s configuration file if it is different from=0A>the default.=0A>--example= =0A>Displays a sample configuration file.=0A>--help=0A>Displays basic help = information.=0A>>--log=3Dfilename=0A>Sets the path and name of the logfile.= The default is /tmp/mysqld_multi.log.=0A>--mysqladmin=3Dpath=0A>Sets the p= ath to the mysqladmin utility.=0A>--mysqld=3Dpath=0A>Specifies the path to = mysqld.=0A>--no-log=0A>>Instructs the utility not to save messages to a log= , but to send them to stdout=0A>instead.=0A>--password=3Dpassword=0A>Provid= es the password for using mysqladmin.=0A>--tcp-ip=0A>Enables TCP/IP communi= cation with the server instead of using a Unix-domain=0A>>socket.=0A>--user= =3Duser=0A>Provides the username for using mysqladmin. The same user must b= e used for all=0A>servers.=0A>--version=0A>Displays the version of the util= ity.=0A>=0AThanks,=0A=0A=0A=0AOn Tue, May 11, 2010 at 9:54 AM, Nitin Mehta = wrote:=0A=0A>Hi,=0A>=0A>>I am exploring multiple instanc= es with MySQL which will be running using the same set of binaries (single = MySQL base). Two things which I'm not able to work out are -=0A>=0A>> = 1. Why mysqld_multi stop doesn't work? Well, I know why it doesn= 't because there is nothing in the script to handle a 'stop' call; the actu= al question would be - why it doesn't work when it is mentioned in the MySQ= L reference manual?=0A>>=0A> 2. how to (auto) restart the instances = after a server restart? do I need to write my own script for this or is the= re anything available which I'm not aware of?=0A>>If you have resolved thes= e issues, please let me know.=0A>> =0A>> =0A>>Best Regards,=0A>Nitin=0A>=0A= >=0A>> =0A=0A=0A-- =0ABest Regards,=0A=0APrabhat Kumar=0AMySQL DBA=0AD= atavail-India Mumbai=0AMobile : 91-9987681929=0Awww.datavail.com=0A=0AM= y Blog: http://adminlinux.blogspot.com=0AMy LinkedIn: http://www.linkedin.c= om/in/profileprabhat=0A=0A=0A=0A --0-1420454395-1273573160=:90226--