[TriLUG] MySQL Replication

Igor Partola igor at igorpartola.com
Thu Jan 29 15:58:37 EST 2015


Here's what I'd do:

1. Disable DNS lookups inside MySQL (see skip-name-resolve option). You
want this off because it both confuses permissions AND makes things
incredibly slow. No idea why MySQL insists on having it on by default.

2. Set up permissions based on IP addresses.

3. Use telnet to connect from slave to master like so: `telnet $MASTER_IP
3306`. If this doesn't work, make sure the master is really listening on
that IP and that port. Of course, make sure the master is running at all.

4. If the master is listening on that port (you can connect from the master
host to `telnet $MASTER_IP 3306` where $MASTER_IP is the 10.x.x.x address,
and you get a "remote host closed connection" then the permissions are
incorrect. Don't forget to FLUSH PRIVILEGES. Remember, MySQL will drop a
connection even before you authenticate if there is no user that's set up
from the client's IP.

5. If you are able to connect via telnet, then try from the slave server
`mysql -u $USERNAME -p --host $MASTER_IP`. Fill in $USERNAME and password.
(BTW, make sure you don't have a ~/my.cnf with the wrong password
somewhere). If this doesn't work, check or reset the password.

6. ...

7. Profit.

BTW, get ready for data inconsistencies. MySQL replication is a fickle
beast. Reading the O'Reilly animal book on MySQL, or at least the relevant
chapters, will be very helpful.

Igor


More information about the TriLUG mailing list