talkli...@newgeo.com (Scott Haneda) writes:

> Hello, I am confused about repliction setup.  Reading a config file,
> and the docs, leads me to believe this is an either code choice, pick
> #1 or #2.  If that is the case, why would I want to use #1 over #2?
> 
> My confusion comes from several online references where there is a
> combination of #1 and #2 going on:
> 
> # To configure this host as a replication slave, you can choose between
> # two methods :
> #
> # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
> #    the syntax is:
> #
> #    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
> #    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
> #
> #    where you replace <host>, <user>, <password> by quoted strings and
> #    <port> by the master's port number (3306 by default).

Use this method. it works and is the correct way to do things. It also will keep
working if you stop and restart the server with replication carrying on
from where it left off.

The procedure is quite simply:

1. Ensure binlogging is enabled on the master.
2. Ensure you setup grant permissions so the slave can connect to the master.
3. Configure on the slave the replication (which databases need to be 
replicated)
4. Get the master and slave in sync (via rsync, load/dump or whatever)
5. Run show master status on the master (assuming binlogging is enabled)
   to get the current position on the master
6. use CHANGE MASTER TO on the slave providing the appropriate permissions.
7. Run: START SLAVE
8. Use: show slave status\G to check how the replication is working, and
   and adjust as necessary.

It's true that initial mysql replication setup is a bit fiddly, but once you've
done it once or twice it's not so hard.

Simon

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to