Jump to content

MySQL Replication - Same server?


Recommended Posts

We've got a number of MySQL databases here at work, but we'd like to setup a replication server to allow us to make incremental backups of just one or two databases (the rest aren't as important). I've read various guides from the MySQL site and others, but they all seem to refer to separate servers - one master and one slave. We're running a single RHEL5 machine, and we don't really have the resources to setup a completely different server.

Here come the questions:

  1. Is it possible to setup two MySQL daemons on the same machine, and keep one as master (server-id=1) and one slave (server-id=2)?
  2. If so, would I need to specify the path of each when accessing the daemons using the mysql command?
  3. Just to check - this shouldn't cause any problems with port access or locks, since the slave is only there to listen to the master, correct?
  4. The actual master/slave configuration would have to be set in $BASEDIR/my.cnf, since /etc/my.cnf is common to both installs, correct?

The server is currently in use, so setting this up with as little reconfiguration as possible on the master would be much appreciated. :)

Link to comment
Share on other sites


It seems as though I answered most of my own questions this morning. :P

1) Yes, it's possible. I did this by compiling a second copy of MySQL to another directory, and then setting the configuration in the my.cnf in each install's respective $BASEDIR.

2) The mysql init.d script that is provided is generated using the directory given during compile configuration. There shouldn't be too much other work you need to do here.

3) You need to configure each replication to listen to a different port, since you can still access and query this server as normal. It just happens to be replicating the master at the same time.

4) /etc/my.cnf is meant for global MySQL options, while the $BASEDIR/my.cnf files should be used for daemon-specific options.

This is what I found in my studies... if anyone has any more feedback or other info, please let me know. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...