Hi,Nitin

    Below information for your reference.

for my.cnf
--------------------------------------------------------
[mysqld5129]
port=5506
socket=/tmp/mysql5129.sock
basedir=/opt/MySQL5129
datadir=/opt/MySQL5129/var
user=mysql
log-error=/var/log/mysqld5129.log
pid-file=/tmp/mysqld5129.pid
#log-bin=/opt/MySQL5129/binlog
long_query_time=2
log-slow-queries=/opt/MySQL5129/slowlog
default-character-set=utf8


[mysqld607]
port=5507
socket=/tmp/mysql607.sock
basedir=/opt/MySQL607
datadir=/opt/MySQL607/var
user=mysql
log-error=/var/log/mysqld607.log
pid-file=/tmp/mysqld607.pid
bind-address=127.0.0.1
skip-name-resolve
------------------------------------------------

For start/stop 
==============================
-bash-3.1# cat /opt/MySQL5129start.sh
/opt/MySQL5129/bin/mysqld_multi start 5129
-bash-3.1# cat /opt/MySQL5129stop.sh
/opt/MySQL5129/bin/mysqld_multi stop 5129

-bash-3.1# cat /opt/MySQL607start.sh
/opt/MySQL607/bin/mysqld_multi start 607
-bash-3.1# cat /opt/MySQL607stop.sh
/opt/MySQL607/bin/mysqld_multi stop 607
==============================


Best Regards!
Yang Wang
 
Email: yw...@lfm-agile.com.hk
----- Original Message ----- 
From: "Nitin Mehta" <ntn...@yahoo.com>
To: "Prabhat Kumar" <aim.prab...@gmail.com>
Cc: <mysql@lists.mysql.com>
Sent: Tuesday, May 11, 2010 6:19 PM
Subject: Re: starting multiple instances with mysqld_multi


Thanks, Prabhat! You're very right, but did you read the questions I asked?






________________________________
From: Prabhat Kumar <aim.prab...@gmail.com>
To: Nitin Mehta <ntn...@yahoo.com>
Cc: mysql@lists.mysql.com
Sent: Tue, May 11, 2010 11:54:22 AM
Subject: Re: starting multiple instances with mysqld_multi

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 by 
storing them in configuration files.

for example, from the command line:

shell> mysqld --port 3306 --log=/path/to/server1/log
shell> mysqld --port 3307 --log=/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 then 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=/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=3306
log=/path/to/log/file/for/server1
(other options here)

and my.server2.cnf is:

port=3307
log=/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=/etc/my.server1.cnf
shell> mysqld --defaults-extra-file=/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 ports. 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. At a 
>minimum,
>each server should use a different socket file and a different TCP/IP port. 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=filename
>Specifies the path and name of the server’s configuration file if it is 
>different from
>the default.
>--example
>Displays a sample configuration file.
>--help
>Displays basic help information.
>>--log=filename
>Sets the path and name of the logfile. The default is /tmp/mysqld_multi.log.
>--mysqladmin=path
>Sets the path to the mysqladmin utility.
>--mysqld=path
>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=password
>Provides the password for using mysqladmin.
>--tcp-ip
>Enables TCP/IP communication with the server instead of using a Unix-domain
>>socket.
>--user=user
>Provides the username for using mysqladmin. The same user must be used for all
>servers.
>--version
>Displays the version of the utility.
>
Thanks,



On Tue, May 11, 2010 at 9:54 AM, Nitin Mehta <ntn...@yahoo.com> 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 able to 
>>work out are -
>
>>        1. Why mysqld_multi stop <grp_id> doesn't work? Well, I know why it 
>> doesn't because there is nothing in the script to handle a 'stop' call; the 
>> actual question would be - why it doesn't work when it is mentioned in the 
>> 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
>
>
>>      


-- 
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



Reply via email to