daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Sep 21st, 2016 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MYSQL_USER=root
  2. MYSQL_PASS=password
  3. MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
  4. SQL="SELECT schema_name FROM information_schema.schemata"
  5. SQL="${SQL} WHERE schema_name NOT IN "
  6. SQL="${SQL} ('information_schema','performance_schema','mysql','test','sys')"
  7. DBLIST=`mysql ${MYSQL_CONN} -ANe"${SQL} 2>/dev/null"`
  8. MYSQLDUMP_OPTIONS="--single-transaction --routines --triggers --master-data=2"
  9. mysqldump ${MYSQL_CONN} ${MYSQLDUMP_OPTIONS} -B ${DBLIST} | gzip > DataFromServerA.sql.gz
  10.    
  11. MYSQL_USER=root
  12. MYSQL_PASS=password
  13. MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
  14. SQL="SELECT schema_name FROM information_schema.schemata"
  15. SQL="${SQL} WHERE schema_name NOT IN "
  16. SQL="${SQL} ('information_schema','performance_schema','mysql','test','sys')"
  17. DBLIST=`mysql ${MYSQL_CONN} -ANe"${SQL} 2>/dev/null"`
  18. MYSQLDUMP_OPTIONS="--single-transaction --routines --triggers --dump-slave=2"
  19. mysqldump ${MYSQL_CONN} ${MYSQLDUMP_OPTIONS} -B ${DBLIST} | gzip > DataFromServerA.sql.gz
  20.    
  21. less DataFromServerA.sql.gz | head -23 | tail -2
  22.    
  23. -- CHANGE MASTER TO MASTER_LOG_FILE='bin-log.001236', MASTER_LOG_POS=102938;
  24.    
  25. MYSQL_USER=root
  26. MYSQL_PASS=password
  27. MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
  28. gzip -d < DataFromServerA.sql.gz | mysql ${MYSQL_CONN}
  29.    
  30. GRANT REPLICATION SLAVE,REPLICATION CLIENT
  31. ON *.* TO 'cutover'@'%'
  32. IDENTIFIED BY 'cutover';
  33.    
  34. CHANGE MASTER TO
  35. master_host='10.20.30.40',
  36. master_port=3306,
  37. master_user='cutover',
  38. master_password='cutover',
  39. master_log_file='bin-log.001236',
  40. master_log_pos=102938;
  41. START SLAVE;
  42. SLAVE SLAVE STATUSG
  43.    
  44. SET GLOBAL read_only = 1;
  45. FLUSH TABLES;
  46. FLUSH LOGS;
  47.    
  48. STOP SLAVE;
  49. RESET SLAVE ALL;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top