gpt4 book ai didi

postgresql - 使用 sudo 命令修改 postgresql.conf 后启动 PostgreSQL 服务器失败

转载 作者:行者123 更新时间:2023-11-29 11:27:10 25 4
gpt4 key购买 nike

我想更改我的 postgresql.conf 文件中的“shared_buffers”参数。

问题是我使用了 sudo 命令并将所有权授予了 root。

-rw-rw-rw-   1 root root  13661 Mar 14 15:36 postgresql.conf

然后我使用以下命令将所有权取回给 postmaster :

sudo chown postgres:postgres /var/lib/pgsql/data/postgresql.conf

所以我尝试了命令:

postgres -D /var/lib/pgsql/data

我很惊讶仍然收到以下错误消息

postgres cannot access the server configuration file "/var/lib/pgsql/data/postgresql.conf": Permission denied

下面是 postgreSQL 目录中“ls”命令的结果:

sudo ls -l /var/lib/pgsql/data/
total 208
drwx------ 19 postgres postgres 4096 Mar 13 17:23 base
drwx------ 2 postgres postgres 4096 Mar 14 14:30 global
drwx------ 2 postgres postgres 4096 Mar 5 14:26 pg_clog
-rw------- 1 postgres postgres 3365 Mar 1 2006 pg_hba.conf
-rw------- 1 postgres postgres 3182 Mar 1 2006 pg_hba.conf.old
-rw------- 1 postgres postgres 1460 Feb 24 2006 pg_ident.conf
drwx------ 2 postgres postgres 139264 Mar 14 00:00 pg_log
drwx------ 4 postgres postgres 4096 Feb 24 2006 pg_multixact
drwx------ 2 postgres postgres 4096 Mar 14 10:42 pg_subtrans
drwx------ 2 postgres postgres 4096 Feb 24 2006 pg_tblspc
drwx------ 2 postgres postgres 4096 Feb 24 2006 pg_twophase
-rw------- 1 postgres postgres 4 Feb 24 2006 PG_VERSION
drwx------ 3 postgres postgres 4096 Mar 14 14:30 pg_xlog
-rw-rw-rw- 1 postgres postgres 13661 Mar 14 15:36 postgresql.conf
-rw------- 1 postgres postgres 49 Jan 2 17:15 postmaster.opts

如果有人知道可能是解决此问题的方法。

提前致谢。

弗雷德

最佳答案

检查 SELinux 是如何运行的:

# sestatus

如果是强制模式,查看日志:

# less /var/log/audit/audit.log

如果您发现 SELinux 阻塞,则暂时禁用 SELinux 以确认它是罪魁祸首:

# setenforce 0

现在尝试启动服务器。如果有效,则重新启用 SELinux:

# setenforce 1

搜索如何恢复该文件的 SELinux 设置。

关于postgresql - 使用 sudo 命令修改 postgresql.conf 后启动 PostgreSQL 服务器失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9704863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com