SHARE
TWEET

Untitled

a guest Sep 14th, 2017 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mysql> SHOW MASTER STATUS;
  2.    
  3. mysql> show master status;
  4. +------------------+----------+--------------+------------------+-------------------+
  5. | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  6. +------------------+----------+--------------+------------------+-------------------+
  7. | mysql-bin.000266 |      120 |              |                  |                   |
  8. +------------------+----------+--------------+------------------+-------------------+
  9. 1 row in set (0.00 sec)
  10.    
  11. [mysqld]
  12. log-bin=mysql-bin
  13.    
  14. GRANT REPLICATION CLIENT,REPLICATION SLAVE ON *.*
  15. TO replicator@'%' IDENTIFIED BY 'replicationpass';
  16.    
  17. MASTER_IP=10.20.30.100
  18. mysql -h${MASTER_IP} -ureplicator -preplicationpass -ANe"SHOW VARIABLES LIKE 'hostname'"
  19.    
  20. mysql> RESET MASTER;
  21.    
  22. MASTER_IP=10.20.30.100
  23. echo "CHANGE MASTER TO master_host='${MASTER_IP}'," > LoadSlaveData.sql
  24. echo "master_post=3306,master_user='replicator'," >> LoadSlaveData.sql
  25. echo "master_password='replicationpass'," >> LoadSlaveData.sql
  26. echo "master_log_file='bogus'," >> LoadSlaveData.sql
  27. echo "master_log_pos=2;" >> LoadSlaveData.sql
  28. DUMP_OPTIONS="-single-transaction --master_data=1 --routines --triggers"
  29. mysqldump --uroot -p ${DUMP_OPTIONS} --all-databases >> LoadSlaveData.sql
  30. echo "START SLAVE;" >> LoadSlaveData.sql
  31.    
  32. mysql -h10.20.30.110 -uroot -p < LoadSlaveData.sql
  33. mysql -h10.20.30.120 -uroot -p < LoadSlaveData.sql
  34. mysql -h10.20.30.130 -uroot -p < LoadSlaveData.sql
RAW Paste Data
Top