on my server ( ubuntu by nginx , docker and Django by gunicorn)
the site is run good but the database sometimes dropped suddenly and i lost my data
this thing many repeated
when i back to
/var/log/postgresql/postgresql-14-main.log
"2023-10-28 12:12:17.689 UTC [3752923] postgres@postgres DETAIL: Connection matched pg_hba.conf line 102: "host all all 0.0.0.0/0 >
2023-10-28 12:12:21.050 UTC [3753069] postgres@template0 FATAL: database "template0" is not currently accepting connections
2023-10-28 12:12:43.319 UTC [3706001] postgres@aeraeg_db FATAL: terminating connection due to administrator command
2023-10-28 12:12:44.912 UTC [3753497] postgres@postgres ERROR: cannot drop the currently open database
2023-10-28 12:12:44.912 UTC [3753497] postgres@postgres STATEMENT: DROP DATABASE postgres;
2023-10-28 12:12:45.541 UTC [3244077] LOG: could not parse file name "pg_logical/snapshots/memory"
2023-10-28 12:12:45.541 UTC [3244077] LOG: could not parse file name "pg_logical/snapshots/prememory"
2023-10-28 12:12:46.226 UTC [3244077] LOG: could not parse file name "pg_logical/snapshots/memory"
2023-10-28 12:12:46.226 UTC [3244077] LOG: could not parse file name "pg_logical/snapshots/prememory"
2023-10-28 12:12:48.206 UTC [3244077] LOG: could not parse file name "pg_logical/snapshots/memory"
2023-10-28 12:12:48.206 UTC [3244077] LOG: could not parse file name "pg_logical/snapshots/prememory"
2023-10-28 12:12:48.556 UTC [3244077] LOG: could not parse file name "pg_logical/snapshots/memory"
2023-10-28 12:12:48.556 UTC [3244077] LOG: could not parse file name "pg_logical/snapshots/prememory"
2023-10-28 12:14:11.702 UTC [3755239] postgres@aeraeg_db FATAL: database "aeraeg_db" does not exist"
how i can protect my database from dropped down
2
Answers
this happen because i changed the listen to
listen"*"
i had been re installed PostgreSQL but don't' make any changing in configuration filesand stopping use remotely connect to database , only in localhost
this is more save and more stability
Take backups, harden your security and keep it up to date.