How to handle new replica in RDS Cluster with Sequelize?

Viewed 1896

We are prepping for a very large surge of traffic, but the question is also meant as a generic one:

Knowing that you can set up Sequelize to use a cluster of RDS Databases (in our case: Aurora) like so:

const master = { rdsClusterWriterEndpoint, username, password, port, database }
const replica = { rdsClusterReaderEndpoint, username, password, port, database }
const Sequelize = require('sequelize')
const sequelize = new Sequelize(null, null, null, {
  dialect: 'mysql',
  pool: {
    handleDisconnects: true,
    min: 0,
    max: 10,
    idle: 10000,
  },
  replication: {
    write: master,
    read: [replica],
  },
})

How could I handle adding a new RDS instance to the cluster to load balance reads even more without reloading the app?

I've pocked around but couldn't find a good way to do it. The DNS resolution seems to be done once at startup time and I haven't found a way to refresh it every once in a while.

Has someone found a safe way of doing this?

Thanks

1 Answers
Related