MySQL Replication
From Kolmisoft Wiki
Jump to navigationJump to search
Server 1 my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1
bind-address = 0.0.0.0
binlog-do-db = mor server-id = 10 auto_increment_increment = 10 auto_increment_offset = 1 master-host = 216.187.103.12 master-user = rep1 master-password = rep1 master-port = 3306 master-connect-retry = 60 replicate-do-db = mor log-bin = /var/lib/mysql/mysql-bin.log log-bin-index = /var/lib/mysql/master-log-bin.index relay-log = /var/lib/mysql/slave-relay.log relay-log-index = /var/lib/mysql/slave-relay-log.index #slave-skip-errors=all
[mysql.server] user=mysql basedir=/var/lib
[mysqld_safe] log-error=/var/lib/mysql/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
Server 2 my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1
bind-address = 0.0.0.0
binlog-do-db = mor server-id = 20 auto_increment_increment = 20 auto_increment_offset = 2 master-host = 216.187.103.18 master-user = rep2 master-password = rep2 master-port = 3306 master-connect-retry = 60 replicate-do-db = mor log-bin = /var/lib/mysql/mysql-bin.log log-bin-index = /var/lib/mysql/master-log-bin.index relay-log = /var/lib/mysql/slave-relay.log relay-log-index = /var/lib/mysql/slave-relay-log.index #slave-skip-errors=all
[mysql.server] user=mysql basedir=/var/lib
[mysqld_safe] log-error=/var/lib/mysql/mysqld.log pid-file=/var/run/mysqld/mysqld.pid