We need to resize the size (CPU and RAM) of two database servers having MySQL server 8: master and slave, but this operation implies that those machines will be restarted, And I think a restart of those machines might cause a problem in replication !

Is there a proper way to restart our machines without breaking the replication, Or I'm wrong about the fact that restarting the master and slave machines (OS) can break the replication ?

1 Answer 1


You can stop and start master and slave in any order you want. It doesn't matter, master first or slave first - for both stop and start.

The only requirement is master's expire_log_days config option should be bigger than maintenance duration. Otherwise master on start will rotate its binlogs faster than slave get a sync. Keep in mind that this variable should be set statically in the my.cnf file, not dynamically via SET GLOBAL expire_log_days = X;

  • 1
    (See also binlog_expire_logs_seconds)
    – Rick James
    Commented Aug 12, 2021 at 18:53
  • Thank you, i didn't mention that we have a cronjob that move binlogs from their location in the master , I have to stop this cronjob before, right ?
    – Hamza AZIZ
    Commented Aug 13, 2021 at 7:05
  • @HamzaAZIZ Right. You need exactly the same layout for master after restart at least until slave will be synced.
    – Kondybas
    Commented Aug 14, 2021 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.