A. background OS: CentOS 4.4 MySQL package: 4.1.20-1.RHEL4.1 node1: 192.168.0.131 (Master 1/Slave 2) node2: 192.168.0.132 (Master 2/Slave 1) mysql path: /var/lib/mysql mysql config file: /etc/my.cnf reference: http://www.howtoforge.com/mysql_master_master_replication http://cha.homeip.net/blog/archives/2004/12/replication_in.html B. procedure 1. On Master 1, make changes in my.cnf #vim /etc/my.cnf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[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 #replication log-bin binlog-do-db=horde binlog-ignore-db=mysql binlog-ignore-db=test server-id=1 [mysql.server] user=mysql basedir=/var/lib [mysqld_safe] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid |
2. On master 1, create a replication slave account in mysql. #mysql -u …