PG::ConnectionBad: connection to server at "34.105.6.235", port 6449 failed: Connection refused

One of my 3 applications is failing. I did migrate the data successfully on all 3 applications. Logs for worker and web both say: PG::ConnectionBad: connection to server at "34.105.6.235", port 6449 failed: Connection refused Tried restarting Postgres:
2024-02-05 22:05:23.269 UTC [8] LOG: starting PostgreSQL 15.4 (Ubuntu 15.4-2.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
2024-02-05 22:05:23.269 UTC [8] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-02-05 22:05:23.269 UTC [8] LOG: listening on IPv6 address "::", port 5432
2024-02-05 22:05:23.282 UTC [8] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-02-05 22:05:23.287 UTC [35] LOG: database system was interrupted; last known up at 2024-02-05 21:59:58 UTC
2024-02-05 22:05:23.331 UTC [35] LOG: database system was not properly shut down; automatic recovery in progress
2024-02-05 22:05:23.334 UTC [35] LOG: redo starts at 0/2ED0A08
2024-02-05 22:05:23.334 UTC [35] LOG: invalid record length at 0/2ED0AF0: wanted 24, got 0
2024-02-05 22:05:23.334 UTC [35] LOG: redo done at 0/2ED0AB8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2024-02-05 22:05:23.338 UTC [33] LOG: checkpoint starting: end-of-recovery immediate wait
2024-02-05 22:05:23.348 UTC [33] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s, sync=0.002 s, total=0.012 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB
2024-02-05 22:05:23.355 UTC [8] LOG: database system is ready to accept connections
2024-02-05 22:05:23.356 UTC [38] LOG: TimescaleDB background worker launcher connected to shared catalogs
2024-02-05 22:05:23.269 UTC [8] LOG: starting PostgreSQL 15.4 (Ubuntu 15.4-2.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
2024-02-05 22:05:23.269 UTC [8] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-02-05 22:05:23.269 UTC [8] LOG: listening on IPv6 address "::", port 5432
2024-02-05 22:05:23.282 UTC [8] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-02-05 22:05:23.287 UTC [35] LOG: database system was interrupted; last known up at 2024-02-05 21:59:58 UTC
2024-02-05 22:05:23.331 UTC [35] LOG: database system was not properly shut down; automatic recovery in progress
2024-02-05 22:05:23.334 UTC [35] LOG: redo starts at 0/2ED0A08
2024-02-05 22:05:23.334 UTC [35] LOG: invalid record length at 0/2ED0AF0: wanted 24, got 0
2024-02-05 22:05:23.334 UTC [35] LOG: redo done at 0/2ED0AB8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2024-02-05 22:05:23.338 UTC [33] LOG: checkpoint starting: end-of-recovery immediate wait
2024-02-05 22:05:23.348 UTC [33] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s, sync=0.002 s, total=0.012 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB
2024-02-05 22:05:23.355 UTC [8] LOG: database system is ready to accept connections
2024-02-05 22:05:23.356 UTC [38] LOG: TimescaleDB background worker launcher connected to shared catalogs
And restarting my apps, but same message. Project #: 9ddc4dfb-ab3f-4809-8481-9657a0c52a43
Solution:
you are still attempting to connect to the legacy database. re-migrate the legacy database https://docs.railway.app/guides/database-migration-guide#re-initiating-migration and then look for any hardcoded database credentials and replace them with environment variables and reference variables, more about this in the docs here https://docs.railway.app/guides/database-migration-guide#switching-over-connections...
Jump to solution
5 Replies
Percy
Percy8mo ago
Project ID: 9ddc4dfb-ab3f-4809-8481-9657a0c52a43
chiperific
chiperific8mo ago
I checked the variables and everything looks correct between the Postgres container and my other services.
Solution
Brody
Brody8mo ago
you are still attempting to connect to the legacy database. re-migrate the legacy database https://docs.railway.app/guides/database-migration-guide#re-initiating-migration and then look for any hardcoded database credentials and replace them with environment variables and reference variables, more about this in the docs here https://docs.railway.app/guides/database-migration-guide#switching-over-connections
chiperific
chiperific8mo ago
How can that be when my variables look like this:
DATABASE_URL=${{Postgres.DATABASE_URL}}
LANG=${{shared.LANG}}
PGDATABASE=${{Postgres.PGDATABASE}}
PGHOST=${{Postgres.PGHOST}}
PGPASSWORD=${{Postgres.PGPASSWORD}}
PGPORT=${{Postgres.PGPORT}}
PGUSER=${{Postgres.PGUSER}}
DATABASE_URL=${{Postgres.DATABASE_URL}}
LANG=${{shared.LANG}}
PGDATABASE=${{Postgres.PGDATABASE}}
PGHOST=${{Postgres.PGHOST}}
PGPASSWORD=${{Postgres.PGPASSWORD}}
PGPORT=${{Postgres.PGPORT}}
PGUSER=${{Postgres.PGUSER}}
? Nevermind, I figured it out. I did have hard-coded variables in my Rails credentials.yml file. Thanks!
Brody
Brody8mo ago
no problem!
Want results from more Discord servers?
Add your server