Score:0

Replicate AWS RDS Postgres instances

gb flag

Faced a situation we need to consolidate few small postgres instances to a bigger one

Cant figure out how to replicate "old" db new data to "new" db when the replacement happens

Ill try to simple it :

old db instance name is X
new db instance is Y

X has 10 GB of data and its takes 15~ minutes to dump & restore
in the meanwhile X receives more data (1-2 MB)

** HOW do i make X replicate data to Y so this data wont get lost ? ** 

I have this small script for dump & restore

## remote db to remote db

PGPASSWORD=$source_pass pg_dump -h $source_host -d $source_db_name -U $source_user -p $source_port > test.sql

psql postgres://$dest_user:$dest_pass@$dest_host:$dest_port/postgres -c "CREATE DATABASE ${source_db_name}" \
-c "CREATE USER ${source_user} WITH PASSWORD '${source_pass}'" \
-c "ALTER USER "${source_user}" WITH CREATEDB" \
|| echo "database already exists"

psql postgres://$dest_user:$dest_pass@$dest_host:$dest_port/$source_db_name < test.sql \
 && echo "loaded Data succesfuly !" || echo "Couldnt load data"
Oscar De León avatar
la flag
Have you tried Data Migration Service (DMS) ?
Eyal Solomon avatar
gb flag
I thought about it but when i try to create a replication instance i see no option of choosing any instances in the instance class option..its says no new generation instances class in this region
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.