Cloud SQL failovers and read replicas

495 views
Skip to first unread message

Miguel Rivas

unread,
Sep 26, 2017, 5:59:29 PM9/26/17
to Google Cloud SQL discuss
I've been testing the failover replica and read replica functionality on GCP and so far it looks great, I can trigger a failover manually and almost instantly the failover replica starts the process to become the master. Now, I've also tested having the three together, that is a master, a failover replica and a read replica and from what I can see there is no interruption trying to connect to the read replica when/while the failover triggers. Does anybody have an idea if the read replica attaches to the "new" master automatically in case of a failover? I've read the docs but there is no explanation whatsoever about this specific scenario. All I could find was this: "Note: Read replicas do not provide failover capability. To provide failover capability for a Second Generation instance, see Configuring an Instance for High Availability." on the "Creating read replicas" documentation.

Thanks in advance for any help.

Kenworth (Google Cloud Platform)

unread,
Sep 26, 2017, 9:20:16 PM9/26/17
to google-cloud...@googlegroups.com

Does anybody have an idea if the read replica attaches to the "new" master automatically in case of a failover?

No, they do not attach to the new master because read replicas do not provide failover capability as you noted. They are used to offload read requests or analytics traffic from the master, not as a failover. You can test this by following these steps:

1- Create a MySQL instance
2- Create a Read replica on #1
3- Run 'gcloud sql instances failover <your_master_replica_name>' 

The simulated failover (#3) will return a 400: Requested operation requires a failover replica, as expected.


Vadim Berezniker

unread,
Sep 27, 2017, 4:08:23 PM9/27/17
to Google Cloud SQL discuss
If I understand correctly, Miguel is asking about what happens to read replicas after a failover.
Read replicas are re-created using the new master.

On Tue, Sep 26, 2017 at 6:20 PM 'Kenworth (Google Cloud Platform)' via Google Cloud SQL discuss <google-cloud...@googlegroups.com> wrote:

Does anybody have an idea if the read replica attaches to the "new" master automatically in case of a failover?

No, they do not attach to the new master because read replicas do not provide failover capability as you noted. They are used to offload read requests or analytics traffic from the master, not as a failover. You can test this by following these steps:

1- Create a MySQL instance
2- Create a Read replica on #1
3- Run 'gcloud beta sql instances failover <your_master_replica_name>' 

The simulated failover (#3) will return a 400: Requested operation requires a failover replica, as expected.


--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/197fa20c-1e3e-4af5-ba61-cd7553b0dfcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Miguel Rivas

unread,
Oct 12, 2017, 10:01:32 AM10/12/17
to Google Cloud SQL discuss
Thanks both for taking the time to post, but yes I know that read replicas don't provide failover capability. I guess I'll do some more testing and will update if anything relevant comes up.


On Wednesday, September 27, 2017 at 2:08:23 PM UTC-6, Vadim Berezniker wrote:
If I understand correctly, Miguel is asking about what happens to read replicas after a failover.
Read replicas are re-created using the new master.

On Tue, Sep 26, 2017 at 6:20 PM 'Kenworth (Google Cloud Platform)' via Google Cloud SQL discuss <google-cloud...@googlegroups.cYepdfdfdfdfdfom> wrote:

Does anybody have an idea if the read replica attaches to the "new" master automatically in case of a failover?

No, they do not attach to the new master because read replicas do not provide failover capability as you noted. They are used to offload read requests or analytics traffic from the master, not as a failover. You can test this by following these steps:

1- Create a MySQL instance
2- Create a Read replica on #1
3- Run 'gcloud beta sql instances failover <your_master_replica_name>' 

The simulated failover (#3) will return a 400: Requested operation requires a failover replica, as expected.


--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages