mysql:changemasters
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
mysql:changemasters [2015/06/24 16:13] – [First: make future-master to become an slave of master] rlunaro | mysql:changemasters [2022/12/02 21:02] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 71: | Line 71: | ||
make sure all the changes were updated. | make sure all the changes were updated. | ||
+ | ===== Second: make the slave to change the master ===== | ||
+ | We have this: | ||
- | This explains how to change the master of a running | + | {{ :mysql:20150623_mysql_step_1.png? |
- | - Create a new slave wihtout downtime | + | And now we want this: |
- | - Stop the current master and start a new master (the last slave) | + | |
+ | {{: | ||
+ | For that, we have to: | ||
+ | |||
+ | - Stop the master | ||
+ | - Check that both slaves are up-to-date | ||
+ | - issue a [[https:// | ||
+ | |||
+ | ==== Stop the master ==== | ||
+ | |||
+ | Nothing new under the sun: | ||
+ | |||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | or: | ||
+ | |||
+ | < | ||
+ | net stop mysql | ||
+ | </ | ||
+ | |||
+ | ==== Check that both slaves are up-to-date ==== | ||
+ | |||
+ | Among the information that '' | ||
+ | both database servers are in the same position. | ||
+ | |||
+ | ==== Create (if it does not exist) a replication user in future-master ==== | ||
+ | |||
+ | < | ||
+ | grant replication slave, replication client on *.* to YOUR-REPLICATION-USERNAME identified by ' | ||
+ | </ | ||
+ | |||
+ | ==== Check master status an take note of the master log file and master log position ==== | ||
+ | |||
+ | We have to issue a '' | ||
+ | |||
+ | < | ||
+ | mysql> show master status\G | ||
+ | *************************** 1. row *************************** | ||
+ | File: YOUR-MASTER-LOG-FILE | ||
+ | | ||
+ | | ||
+ | | ||
+ | Executed_Gtid_Set: | ||
+ | 1 row in set (0.00 sec) | ||
+ | </ | ||
+ | |||
+ | With this two values, YOUR-MASTER-LOG-FILE and YOUR-MASTER-LOG-POS, | ||
+ | slave and issue a change master to command. | ||
+ | |||
+ | ==== Issue a change master command ==== | ||
+ | |||
+ | In the slave server I've issued a '' | ||
+ | |||
+ | < | ||
+ | stop slave; | ||
+ | |||
+ | change master to master_host=' | ||
+ | master_port=3306, | ||
+ | master_user=' | ||
+ | master_password=' | ||
+ | master_log_file = ' | ||
+ | master_log_pos = YOUR-MASTER-LOG-POSITION; | ||
+ | |||
+ | start slave; | ||
+ | </ | ||
+ | |||
+ | And I've stopped and started the slave. | ||
+ | |||
+ | ===== Final check ===== | ||
+ | |||
+ | You can double check that your slave is working with the new configuration just by the method of looking | ||
+ | one change made in the new master. | ||
- | https:// | ||
mysql/changemasters.1435162422.txt.gz · Last modified: 2022/12/02 21:02 (external edit)