0
votes

I am using Amazon Aurora and I have 2 database server by default: The Reader instance and the Writer instance.

My application is connecting to the primary connection endpoint

sample.cluster-sample.us-west-2.rds.amazonaws.com

However, my application can't write data into the database suddenly and I found the replica (sample-instance-r1) has become Writer instance.

My application is programmed using Node.js with mysql plugin and using connection pool. How can I avoid amazon RDS switch the Writer instance and thus not able to write data?

1

1 Answers

1
votes

The cluster endpoint address does not change due to failover:

To use a connection string that stays the same even when a failover promotes a new primary instance, you connect to the cluster endpoint. The cluster endpoint always represents the current primary instance in the cluster.

So what you are describing does not normally happen when you are using cluster endpoint (not counting the time required for the failover to compete). Thus please make sure that you application is actually using that endpoint as Aurora has multiple endpoints.