Backup Restore

Backup

pg_dump -h host -U postgres db | gzip > backup.gz

Restore

psql -U postgres -W -d db -f backup

backup.dump ile uzantılı yedeklerin geri yüklenmesi

Amazon RDS üzerinden otomatik yedek alarak S3'e atıyorum. Aşağıdaki script bu iş için çok ideal.

https://gist.github.com/valferon/4d6ebfa8a7f3d4e84085183609d10f14

S3'deki bu yedeği local makinemize aşağıdaki komutla yükleyebiliriz.

ERROR: role "rdsadmin" does not exist gibi bir hata verir. Çok önemli değil. Veri tabanı başarıyla yüklenmiştir.

pg_restore -U postgres -d selam backup.dump

Last updated