Controlling AWS RDS Posgres Failover Conditions/Criteria - postgresql

Here is the problem I am dealing with AWS RDS Postgres:
RDS Postgres instance is failing over and restarting. I know why: high swap and low memory. But I'm trying to find (and ideally change/override) the exact criteria that AWS is using to determine the condition/reason to fail-over. I've searched online and the config, nothing.
Can anyone with experience/knowledge of AWS RDS fail-over help?
Best Regards,
Michael

Related

Aurora-PostgreSQL 12 config param related to CTE

I wanted to know if there are any Postgres config parameter settings available for CTEs in specific? The reason I am asking this is because we migrated a DB from AWS RDS Postgres to Aurora Postgres with the same major version (Postgres v12). Both the DB's have the same structure/indices/etc., however when we run the same CTE on Aurora, it runs very slow and shows very high IOPS v/s when we run it on RDS, it runs fast and no IOPS issue there. I am assuming that there might be some config setting which is different in RDS v/s Aurora which is causing the issue.
Any suggestions/recommendations?
Thanks

How to confirm Multi-AZ for Postgres and Aurora Postgres in Amazon AWS

I want to use MultiAZ for Postgres and Aurora Postgres databases.
In the Postgres database configuration tab it shows:
Multi-AZ
yes
Secondary Zone
ap-south-1a
But I can't find any reader in the db list overview.
Whereas in the Aurora Postgres it shows on the cluster:
Availability
Multi-AZ
2 Zones
AND there is a reader in another availability zone without any read access in the db list overview.
It's a bit confusing. Do I have enabled MultiAZ in both?
It's a bit confusing. Do I have enabled MultiAZ in both?
Mutli-AZ in RDS and Aurora works differently. In Aurora, your fail-over instance is one of the readers. Thus it does not have a dedicated Multi-AZ option.
In contrast, in RDS, multi-AZ readers are not used for multi-AZ. Instead, RDS creates a special db instance, called standby replica (this is not read replica). The main purpose of this standby instance is to be your fail-over in case primary instance fails. Also the standby can't be used for reading. You can't connect to it.

Adding Amazon RDS as slave to external postgresql

We want to migrate an external postgresql database into amazon RDS however for some time we need to keep both of them working and in sync. I have found ways of doing it but only with RDS being the master and not the Slave. Is there a good and viable solution which could help us?
There is AWS service Database Migration Service which can be used to migrate external databases to Amazon AWS RDS.
https://docs.aws.amazon.com/dms/latest/userguide/Welcome.html
It supports postgresql 9.4 and higher.
There are different task types and you need to use Ongoing Replication to keep them sync.
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html
To setup that task you need to enable Logical Replication for source database

RDS Postgres Logical Replication into EC2

I'm using postgres 9.5.7 in RDS and want to create a slave/read replica on an EC2 box. I've figured out how to get logical replication working on RDS and am able to use pg_recvlogical to tap into the replication slot on the EC2 box.
My challenge now has been that, unfortunately, RDS doesn't support pglogical and it seems that I'm left with either test_decoding or wal2json for my output formats. Is there something out there that knows how to take either of those formats and turn them into SQL that can be executed on the slave?
Most of the guides I've found online only go as far as getting pg_recvlogical working, and don't take that extra last step of showing how to actually get those changes into the slave database.
perhaps you want to check https://wiki.postgresql.org/wiki/Logical_Decoding_Plugins#decoder_raw
this plugins output a sql statements that can be run in slave postgres

Migrate database from Heroku to AWS

I want to migrate our postgres db from heroku to our own postgres on AWS.
I have tried using pg_dump and pg_restore to do the migration and it works; but it takes a really long time to do this. Our database size is around 20GB.
What's the best way to do the migration with minimal downtime?
If you mean AWS RDS PostgreSQL:
pg_dump and pg_restore
I know you don't like it, but you don't really have other options. With a lot of hoop jumping you might be able to do it with Londiste or Slony-I on a nearby EC2 instance, but it'd be ... interesting. That's not the most friendly way to do an upgrade, to say the least.
What you should be able to do is ship WAL into RDS PostgreSQL, and/or stream replication logs. However Amazon don't support this.
Hopefully Amazon will adopt some part of 9.4's logical replication and logical changeset extraction features, or better yet the BDR project - but I wouldn't hold my breath.
If you mean AWS EC2
If you're running your own EC2 instance with Pg, use replication then promote the standby into the new master.