Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Trying to run multiple Mysql servers on a single machine
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Thu Oct 28, 2004 10:11 pm    Post subject: Trying to run multiple Mysql servers on a single machine Reply with quote

I'm building a nice little database backup machine for a number of my database server. Since Mysql can only have one master I need to run three or four separate Mysql servers, not threads or processes, but actual separate servers. Each Mysql server on the backup machine will have a different master so I can replicate each production database to a single machine.

Ideally the would each run on a different port 3306, 3307, etc and have data in different dirs like /var/lib/mysql, /var/lib/mysql2, etc.

Unfortunately it appears that the ebuild hardcodes a number of things into the binary or I haven't found the right config setting to get two instances running at the same time. I'd prefer to handling everything via separate configs and not have to recompile mysql a number of times. Something like this:

cp -a /var/lib/mysql/ /var/lib/mysql2/
cp -a /var/log/mysql/ /var/log/mysql2
cp -a /var/run/mysqld/ /var/run/mysqld2/
cp -a /etc/mysql/ /etc/mysql2/

and then editting config files as needed. Has anyone done something like this? Or am I going to have to mess with the ebuild and install in /usr/local/mysql1, /usr/local/mysql2, and so on?

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Thu Oct 28, 2004 10:22 pm    Post subject: Re: Trying to run multiple Mysql servers on a single machine Reply with quote

kashani wrote:
Or am I going to have to mess with the ebuild and install in /usr/local/mysql1, /usr/local/mysql2, and so on?

thats what i would do, but i wouldnt use the ebuild then, i would compile from the source tarball and use different --prefix parameters.
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Fri Oct 29, 2004 2:26 pm    Post subject: Reply with quote

It's actually not that hard to do from the ebuild, but you have to be careful. Assuming I'm stuck doing it that way, I imagine this might work.

1. uninstall mysql
2. modify the ebuild to use ../mysql5/, run the emerge
3. modify the ebuild to use ../mysql4/, run the emerge
...
6. run sync again, emerge mysql

This worked for qmail when I needed multiple instances, though mysql src isn't near the mess qmail is with the 10 odd patches I would have manually had to apply. Hmmm, well I guess I know how I'm burning the next few hours.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
EnricoHorn
Apprentice
Apprentice


Joined: 23 Apr 2003
Posts: 165
Location: Koenigsee, Thuringia, Germany

PostPosted: Fri Oct 29, 2004 7:26 pm    Post subject: Reply with quote

Did you look at mysqld_multi? Did not try it, but seems a possible solution.
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Sun Oct 31, 2004 9:51 pm    Post subject: Reply with quote

kashani wrote:
It's actually not that hard to do from the ebuild

it is - on the long run.
imagine "-u world".. how are you going to handle that one? well, you would have to inject the package, perhaps, though..
i am still unsure what happens if you inject a package (mplayer in my case - of course). sofar this works out nice, but infact a new version gets marked stable, what will happen then?
thats why i would not use the ebuild.

what i did (with mplayer, just as an example) was emerging it, just to make sure it does every dependency. then i unmerged it using "-C" and installed it from source.
this makes sure portage does not complain about it in the future.

yes, portage is nice, but i dislike to have it takeing care for me about everything ;(
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Mon Nov 01, 2004 4:21 pm    Post subject: Reply with quote

You're assuming I'd touch Mysql again on this box. If I were to get everything to work at any point, I'm slapping a package.mask in and never touching Mysql again. Since it's internal only and just needs to run Mysql reasonably well, doing an emerge -u world is just asking for trouble.

mysqld_multi looks exactly like what I want, but I can't figure out how to make it work. All the config examples are the same and using them doesn't appear to actually do anything on my system. Oddly I can't find anyone who actually seems to be using it.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum