1

I'm trying to figure out what needs to happen in mysql 8 when the master db IP in a replication setup changes (my ISP just randomly changed my IPs).

I found this article:

Change host IP of master in mysql replication

But it seems to talk about pre-8 commands, and also didn't work (got some error).

The commands that seem to be the ones that apply are:

> STOP SLAVE
> SHOW REPLICA STATUS\G
> CHANGE REPLICATION SOURCE TO ...
> START SLAVE

But I just don't know what exactly I should change in the "CHANGE REPLICATION SOURCE" cmd, in particular given the previous article mentioning this bin log file, and the master_log_pos. I would think just changing the IP should suffice, but...

1 Answer 1

1

BTW, we prefer to say "source" instead of "master" now. The old commands still work in MySQL 8.0, but they are being phased out, so it would be a good idea to start using the new commands.

If the source IP address is the only thing that changed, then you don't have to change the binary log file or position. If you run on the replica instance the statement STOP REPLICA then that just pauses exactly at the binary log position the replica was at when you issued that statement.

Then on the replica instance you use CHANGE REPLICATION SOURCE TO SOURCE_HOST='...' and set that to either the hostname or IP address of the source instance.

Once you do that to reconfigure replication, run on the replica instance START REPLICA. It will resume where it left off.

1
  • That did it, thank you.
    – Jack
    Commented May 15, 2023 at 2:15

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.