????????????????MySQL?????????????????????????????????????????????????????????????????????????????????MySQL????????????????????????????????????????????β?????
???????????????????????????????????mysqldump????????????????mysqldump???????????????????????????????????????????????????????????xtrabackup???????????????????xtrabackup??????????????????????????????????????????????????????????и??μ??????????д?????????У???????鵽????????У??????????????????
???????????????
????????192.168.18.212????У?
???????1??192.168.18.213????У?
???????2??192.168.18.214????????
?????????汾??MySQL5.5
?????洢???棺Innodb
?????????????weibo
???????mysqldump???
????MySQL?????????binlog??????????????????????????binlog??????????????????????binlog??????????????????????????????
??????????????ò??????£?
????# vi my.cnf
????server-id = 1             #id?
????log-bin = mysql-bin         #????binlog???
????auto-increment-increment = 1   #??Ubuntu????MySQL5.5???????????1
????auto-increment-offset = 1
????slave-skip-errors = all      #??????????????????
????1. ????????????
????mysql> grant all on *.* to 'sync'@'192.168.18.%' identified by 'sync';
????2. ???????MySQL
????# vi my.cnf
????server-id = 3             #???????3
????log-bin = mysql-bin         #????binlog???
????auto-increment-increment = 1   #????????????Ubuntu????MySQL5.5???????????1
????auto-increment-offset = 1
????slave-skip-errors = all      #??????????????????
????3. ????????
????# mysqldump -uroot -p123 --routines --single_transaction --master-data=2 --databases weibo > weibo.sql
?????????????
????–routines???????洢????????
????–single_transaction???????????????????????????????????????????????unlock tables;??lock-tables????????????д?????????dump????
????–master-data????????1????dump?????change master to??binlog???pos?д??????У?????2???change master toд??????в?????
????4. ?????????????
????# scp weibo.sql root@192.168.18.214:/home/root
????5. ????????test_tb????????????????????weibo.sql????е?
????mysql> create table test_tb(id int??name varchar(30));
????6. ????????
????# mysql -uroot -p123 -e 'create database weibo;'
????# mysql -uroot -p123 weibo < weibo.sql