Friday, May 10, 2013

MySQL Ring Replication Configurations

my.cnf / my.ini



[mysqld]
server-id = 1
replicate-same-server-id = 0
auto-increment-increment = 10
auto-increment-offset = 1
log-bin = mysql-bin
log-slave-updates


SQL

ON MASTER

FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
UNLOCK TABLES;

ON SLAVE

CHANGE MASTER TO
    MASTER_HOST='master_host_name',
    MASTER_USER='replication_user_name',
    MASTER_PASSWORD='replication_password',
    MASTER_LOG_FILE='recorded_log_file_name',
    MASTER_LOG_POS=recorded_log_position,
    MASTER_CONNECT_RETRY=10;