'How to make always active session for postgresql?

Previously, I had a django application/database on the same server. Now I have made one server with application, one server with database(Debian 11; Postgresql 12.9 (Install via Homebrew))

Problem: after a few hours there are problems with connecting to the database...

postgres log:

2022-01-24 23:27:00.315 UTC [9982] LOG:  received smart shutdown request
2022-01-24 23:27:00.323 UTC [9982] LOG:  background worker "logical replication launcher" (PID 9996) exited with exit code 1
2022-01-24 23:27:00.324 UTC [9991] LOG:  shutting down
2022-01-24 23:27:00.344 UTC [9982] LOG:  database system is shut down

/var/log/syslog:

Jan 24 23:27:00 d systemd[1]: Stopping User Manager for UID 1000...
Jan 24 23:27:00 d systemd[8909]: Stopped target Main User Target.
Jan 24 23:27:00 d systemd[8909]: Stopping D-Bus User Message Bus...
Jan 24 23:27:00 d systemd[8909]: Stopping Homebrew generated unit for postgresql@12...
Jan 24 23:27:00 d systemd[8909]: dbus.service: Succeeded.
Jan 24 23:27:00 d systemd[8909]: Stopped D-Bus User Message Bus.
Jan 24 23:27:00 d systemd[8909]: [email protected]: Succeeded.
Jan 24 23:27:00 d systemd[8909]: Stopped Homebrew generated unit for postgresql@12.
Jan 24 23:27:00 d systemd[8909]: [email protected]: Consumed 1min 22.614s CPU time.
Jan 24 23:27:00 d systemd[8909]: Removed slice app-homebrew.postgresql.slice.
Jan 24 23:27:00 d systemd[8909]: app-homebrew.postgresql.slice: Consumed 1min 22.614s CPU time.
Jan 24 23:27:00 d systemd[8909]: Stopped target Basic System.
...

I connect to server via terminal from my local computer. I see only my sessions(loginctl list-sessions), if I kill it, then postgresql will fall again.

I need to create a user that will be permanently active? How to do it right?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source