-
bin.000001 –start-position=n > /data/add.sql
bin.000002 … mysql-bin.n >> /data/add.sql
mysql -u -p -S < /data/add.sql
-
mysqlbinlog mysql-bin.000001 –start-position=n | mysql -u -p -S
mysqlbinlog mysql-bin.000002 … mysql-bin.n | mysql -u -p -S
-
SET GLOBAL relay_log_info_repository=’FILE’;
CHANGE MASTER TOmaster_host=’1′,master_password=’1′,master_user=’1′,master_log_file=’1′,master_log_pos=4;
-
cp mysql-bin.000003 mysql-bin.000004 mysql-bin.000005 mysql-bin.000006 mysql-bin.000007 mysql-bin.000008 mysql-bin.000009 mysql-bin.000010 $relaylogdir
cd $relaylogdir
rename mysql-bin. mysql-relay. mysql-bin.0000*
chown mysql:mysql -R .
-
/data/mysql57/relaylog/mysql-relay.000003
1276895
-
/data/mysql57/relaylog/mysql-relay.000003
/data/mysql57/relaylog/mysql-relay.000004
/data/mysql57/relaylog/mysql-relay.000005
/data/mysql57/relaylog/mysql-relay.000006
/data/mysql57/relaylog/mysql-relay.000007
/data/mysql57/relaylog/mysql-relay.000008
/data/mysql57/relaylog/mysql-relay.000009
/data/mysql57/relaylog/mysql-relay.000010
-
START SLAVEsql_thread ;
-
mysql> SHOW SLAVE STATUSG
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 1
Master_User: 1
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: 1
Read_Master_Log_Pos: 4
Relay_Log_File: mysql-relay.000003 — 已经执行到的日志名
Relay_Log_Pos: 11529982 — 已经执行到日志的位置
Relay_Master_Log_File: 1
Slave_IO_Running: No
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 11529982
Relay_Log_Space: 5347038913
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 274354 — 若变为0,则表示已经增量完毕
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: /data/mysql57/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Reading event from the relay log
Master_Retry_Count: 86400
………………………………
:http://www.linuxidc.com/Linux/2017-09/146648.htm