Postgresql无法启动。重新启动正在重置授予/ var / run / postgresql /

问题描述 投票:0回答:1
FATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.1111.lock": Permission denied
psql: could not connect to server: Connection refused
        Is the server running on host "S01B01" (10.10.222.193) and accepting
        TCP/IP connections on port 1111?

您能帮我获得对此的永久性修复。

postgresql.conf:

data_directory = '/apps/ins/router/pgdata'

hba_file = '/apps/ins/router/pgdata/pg_hba.conf'

pg_hba.conf:

host     all             ins        10.10.10.10    255.255.255.255    trust
host     all             ins        127.0.0.1      255.255.255.255    trust
postgresql
1个回答
0
投票

PostgreSQL的两个套接字目录(/run/postgresql/var/run/postgresql)都是在引导时创建的临时目录。 (实际上,/var/run/postgresql通常是指向/run/postgresql的符号链接)。

随着systemd的出现,引入了一种名为systemd-tmpfiles的新机制来管理临时文件和目录。

Systemd-tmpfiles在引导期间创建临时目录,并设置其所有者,组和权限。它可能会在三个不同的位置读取配置文件。 /etc/tmpfiles.d中的文件将覆盖/usr/lib/tmpfiles.d/run/tmpfiles.d.]中具有相同名称的文件>

检查那些配置目录以获取PostgreSQL配置,通常是postgresql.conf。 (您很可能会在/usr/lib/tmpfiles.d/postgresql.conf处找到它。)该文件将包含以下内容:

d /run/postgresql 0755 postgres postgres -

您可以通过编辑该行来更改权限,所有者和组。但是,建议进行此类更改的方法不是直接编辑/usr/lib/tmpfiles.d/下的文件,而是将配置文件复制到/etc/tmpfiles.d/,然后在该副本中进行必要的更改。

© www.soinside.com 2019 - 2024. All rights reserved.