Overcoming IP address hardcoding related Misconfiguration in AWS RDS HA setup

Problem :


In AWS HA RDS cluster setup for Mattermost, in the wake of an event like AWS failover(where IP address changes), using hard-coded IP address instead of the cluster endpoint in the "Datasource" configuration will cause an initialisation error in the application. This can lead to production downtime. Mattermost requires the correct writer node endpoint, aligning with AWS standards, to ensure smooth failover when instances switch to act as the primary writer node.

The log might display an error like:

"level":"fatal","msg":"Failed to apply database migrations.","caller":"sqlstore/store.go:173","error":"pq: cannot execute CREATE TABLE in a read-only tra "


Solution :


To fix the misconfiguration in the Mattermost AWS HA RDS cluster setup, perform the following steps using a database management tool(e.g. pgadmin workbench)

  • Log in to the database using the 'mmuser' credentials
  • Run the query select * from configuration where active = True;
  • Review the configuration file to locate the 'Datasource' value under 'Sqlsettings'
  • Edit the 'Datasource' value, replacing it with the writer endpoint of the cluster
  • Save the changes to the configuration file
  • Start mattermost -systemctl start mattermost
Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.