Backup failing in pg_dump due to connection failure


(Martin Korndoerfer) #1

I’m using Discourse for a very small site I’m hosting on AWS on an Ubuntu 16.04.3 LTS based ec2 instance.

The forum itself is working flawlessly, but since last march, the daily backup started to fail. Every single day. Same is true if I start a manual backup.

I’ve updated regularly (running 2.0.0.beta9 right now) but the problem didn’t change

The error message is most curious, it’s telling me that pg_dump cannot connect to the database:

[2018-05-05 16:02:13] 'Martin' has started the backup!
[2018-05-05 16:02:13] Marking backup as running...
[2018-05-05 16:02:13] Making sure '/var/www/discourse/tmp/backups/default/2018-05-05-160212' exists...
[2018-05-05 16:02:13] Making sure '/var/www/discourse/public/backups/default' exists...
[2018-05-05 16:02:13] Pausing sidekiq...
[2018-05-05 16:02:13] Waiting for sidekiq to finish running jobs...
[2018-05-05 16:02:13] Dumping the public schema of the database...
[2018-05-05 16:04:20] pg_dump: [archiver (db)] connection to database "newspiral" failed: could not connect to server: Connection timed out
[2018-05-05 16:04:20] EXCEPTION: pg_dump failed
[2018-05-05 16:04:20] /var/www/discourse/lib/backup_restore/backuper.rb:170:in `dump_public_schema'

If the configuration of the database connection would be broken, the forum wouldn’t work at all, but it’s working just fine. I just don’t see why pg_dump wouldn’t be able to connect to the database while the rest is working.

Is there a way to see the actual command line that’s fed to pg_dump? So I could try and debug it from the console? Can the backup process be made more verbose so we can see what’s actually happening?

Thanks for your assistance!