Reputation: 666
I have a 2nd generation instance, with a failover instance added to it. But from time to time I get errors in my application: "Unable to connect to any of the specified MySQL hosts". Why doesn't it switch to the failover?
According to Google's documentation I don't need to do any additional changes to my application to connect to the failover server (https://cloud.google.com/sql/docs/high-availability#how_failover_affects_your_applications_and_your_instances):
When a zonal outage occurs and your master fails over to your failover replica, any existing connections to the instance are closed. However, your application can reconnect using the same connection string or IP address; you do not need to update your application after a failover.
I have also tried to restart the master instance to test the failover, from Google documentation:
Test how your application responds to lost connections by restarting your instance.
And while it's restarting, I also get the "Unable to connect to any of the specified MySQL hosts" error message on my application.
PD: My application is not hosted with Google Cloud Platform servers (on Linode), do you think the errors are caused by network connectivity between my server and Google? But then when I manually restart the master it should start the failover.
Upvotes: 0
Views: 566
Reputation: 3579
Failover replicas are meant for zone outages. The failover process is not completely seamless, and you may see dropped connections during the failover. The failover is not triggered during instance restarts because those normally take a few seconds to come back. Zone outages can potentially last much longer.
Upvotes: 1