Skip to content

How do I minimize application downtime and connection errors during Amazon Aurora cluster failovers?

2 minute read
0

I want to minimize application downtime and connection errors when failovers occur in my Amazon Aurora MySQL-Compatible Edition cluster.

Resolution

When a failover occurs in an Aurora MySQL-Compatible cluster, the cluster might experience temporary connection interruptions and errors due to downtime. If you didn't correctly configure the settings, then the application downtime is prolonged. To minimize the application downtime during failover, take the following actions.

Use the cluster and reader endpoints

Connect to the cluster endpoints and reader endpoints. It's a best practice to not connect to individual DB instance endpoints. The cluster and reader endpoints automatically follow the changes in instance roles after failover. Use the cluster endpoint to automatically point to the current writer DB instance for read and write operations. Use the reader endpoint to automatically point to the available reader DB instances for read operations.

Set a low DNS TTL value

If your application caches the DNS endpoints of the Amazon Aurora DB instances, then set a time-to-live (TTL) value of less than 30 seconds. The TTL value makes sure that stale DNS data doesn't cache for too long after a failover when the underlying IP addresses might change. If you set the TTL value too high, then your application might use the old IP address after a failover, and can prolong connection errors.

Use the AWS JDBC Driver

Use the AWS Java Database Connectivity (JDBC) Driver to switch the connection to a new writer or reader DB instance without relying on DNS propagation. The driver can quickly restore your connection. For more information, see AWS JDBC Driver on the GitHub website.

Use the Amazon RDS Proxy

Use Amazon RDS Proxy to connect directly to the DB instances. The proxy automatically routes traffic to the new writer DB instance and minimizes application downtime during failovers. The proxy bypasses DNS caching issues and preserves existing connections during a failover. Amazon RDS Proxy tracks DB instance roles based on the cluster metadata without relying on DNS. The proxy can help quickly restore the connection and might be faster than waiting for DNS propagation.

Related information

Introducing the Advanced JDBC Wrapper Driver for Amazon Aurora

Improve application availability on Amazon Aurora

AWS OFFICIALUpdated a year ago
1 Comment

Thanks for sharing. I will definitely try the AWS JDBC

replied a year ago