Mysql Failover Script

Hi all,
I have master-slave node’s. This node’s 5.7 Mysql version. I want to change master-slave node’s.
How can ı this situation? Could you help me for this script.

Regards.

Hello @parttime,
Can you explain that a bit more? I’m not sure I understand. You have a master-slave setup and you want to change, what exactly?

ı want to switcth from master to slave.

There is no standard script for this. Switching master to slave is something you will have to create for yourself. The process goes like this:

  1. Put mysql master into read-only mode
  2. Stop application traffic
  3. stop replication from master->slave
  4. setup different replication from slave->master
  5. point application to slave (now the new master)
  6. start application

The application will now write to slave/new-master which will replicate to old-master

You could also configure master/master replication (also known as source/source) and you can flip between them whenever you like.