128 Machine:
[Email protected] ~]#/etc/init.d/mysqld restartshutting down MySQL. success! Starting MySQL. success!
129 machine:
[Email protected] ~]#/etc/init.d/mysqld restartshutting down MySQL. success! Starting MySQL. success!
First with master and slave:
128 on the machine:
Copy the data and transfer it to 129 machines.
[[email protected] ~]# mysqldump-uroot-p123456--all-databases >/tmp/mysqlall.sql[[email protected] ~]# scp-r/tmp/ Mysqlall.sql 192.168.65.129:/tmp/
mysql> grant replication Slave on * * to ' REPL ' @192.168.65.129 identified by ' 123456 ';mysql> flush privileges;
Test machine data changes basically no, so we don't lock the table.
129 on the machine:
[Email protected] ~]# mysql-uroot-p123456 </tmp/mysqlall.sql
mysql> stop Slave; Query OK, 0 rows Affected (0.00 sec) mysql> Change master to master_host= ' 192.168.65.128 ', master_user= ' repl ', MASTER_PA Ssword= ' 123456 ', master_log_file= ' thermos.000001, master_log_pos=420; Query OK, 0 rows affected, 2 warnings (0.01 sec) mysql> start slave; Query OK, 0 rows affected (0.01 sec) mysql> Show slave status\g
Master-Slave synchronization complete
Primary Master synchronization:
129 on the machine:
Change/etc/my.cnf, add Log_bin
[Email protected] ~]#/etc/init.d/mysqld restartshutting down MySQL. success! Starting MySQL. success!
mysql> grant replication Slave on * * to ' REPL ' @192.168.65.128 identified by ' 123456 '; Query OK, 0 rows Affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec)
128 on the machine:
mysql> stop Slave; Query OK, 0 rows Affected (0.00 sec) mysql> Change master to master_host= ' 192.168.65.129 ', master_user= ' repl ', MASTER_PA Ssword= ' 123456 ', master_log_file= ' alex.000001 ', master_log_pos=420; Query OK, 0 rows affected, 2 warnings (0.01 sec) mysql> start slave; Query OK, 0 rows Affected (0.00 sec) mysql> Show slave status\g
Test the primary master
128 on
129 on
(already more Micheal library)
129 on
128 on
(More Jackson Library)
Self-study, do not know the right or not, if there is a mistake, look correct!
MySQL dual master (Master) architecture