LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Multiple Instances of MySQL (https://www.linuxquestions.org/questions/linux-server-73/multiple-instances-of-mysql-718516/)

neoform 04-11-2009 08:09 PM

Multiple Instances of MySQL
 
I'm trying to setup 2 instances of mysql on one machine (Replication of 2 machines, so I can back them up without shutting them down)..

But I can't figure out where in the daemon file the my.cnf file is assigned..

I've already got two copies of my.cnf, two log dirs, two data dirs and I've set up separate daemon files... in /etc/rc.d/init.d/

but after searching through them, I can't figure out where I can assign the conf file...

Anyone know? Thanks

jstephens84 04-11-2009 08:18 PM

Ok so after looking at the mysql site it looks like you need to specify two cnf files. like my1.cnf and my2.cnf. Then under your etc rc locate the mysql startup file and change the my.cnf file that is loaded. Now each mysql file will need to have different ports , sockets, pid-files, and shared memory base names.

neoform 04-11-2009 08:49 PM

Quote:

Originally Posted by jstephens84 (Post 3505942)
Then under your etc rc locate the mysql startup file and change the my.cnf file that is loaded.

That's just my problem though.. in the file /etc/rc.d/init.d/mysql there's no mention of the file my.cnf file anywhere..

:(

jstephens84 04-11-2009 09:18 PM

Quote:

Originally Posted by neoform (Post 3505955)
That's just my problem though.. in the file /etc/rc.d/init.d/mysql there's no mention of the file my.cnf file anywhere..

:(

the /etc/init.d and /etc/rc.d/init.d mysql is the binary. You actully want to look in inittab and find out your systems default runtime. Then find the file that has and S99 or K99 or something to that effect. That will be the loading script that contains the call to load mysql with the specified my.cnf file. what distro are you using for this?

neoform 04-11-2009 09:37 PM

I'm not sure I understand..

jstephens84 04-11-2009 10:02 PM

Ok I think I did get a little confusing on my last post. In short what you are actually looking at is the binary file. Not the script that calls the binary. Also the binary will look for the default my.cnf file. As far as I know. So what you will want is a script that calls the mysqld binary and uses a parameter that specifies which my.cnf file to use.


Can you post what distro you are using? That way I can tell how bootup scripts are called. Also check for things like /etc/rc2.d or /etc/rc.d/rc2 or 3. Under those directories try looking for a mysql script in there. That is what should be specifing what .cnf file is being called.

neoform 04-11-2009 10:33 PM

I'm using Fedora 10.

jstephens84 04-12-2009 05:29 AM

Ok so further digging led me to here. http://dev.mysql.com/doc/refman/4.1/...qld-multi.html It looks like you will still use the same my.cnf file but specify the multiple instances in your my.cnf file. IE
[mysql0] at the bottom of the page there looks like a good example of a my.cnf file for reference. Hope this clears up a little bit.

neoform 04-12-2009 10:43 AM

Thanks for the find..

I'm gonna have to read into mysqld_multi.. :)


All times are GMT -5. The time now is 11:58 PM.