1

我会以我没有太多使用 PostgreSQL 的事实作为开头。我尝试将它与 RoR 一起使用,但事实上它使用 ORM,我不明白为什么PostgreSQL 是首选。

在与在 Ubuntu 14.04 上安装该死的东西作斗争之后,我需要克隆一个依赖它的 repo。

经过大约 30 分钟的尝试,我发现:

$ /usr/lib/postgresql/9.4/bin/postgres -d 3 -D /var/lib/postgresql/9.4/main -c config_file=/etc/postgresql/9.4/main/postgresql.conf 
LOG:  skipping missing configuration file "/var/lib/postgresql/9.4/main/postgresql.auto.conf"
2015-02-14 21:05:01 PST [7665-2] FATAL:  data directory "/var/lib/postgresql/9.4/main" has wrong ownership
2015-02-14 21:05:01 PST [7665-3] HINT:  The server must be started by the user that owns the data directory.
2015-02-14 21:05:01 PST [7665-4] DEBUG:  shmem_exit(1): 0 before_shmem_exit callbacks to make
2015-02-14 21:05:01 PST [7665-5] DEBUG:  shmem_exit(1): 0 on_shmem_exit callbacks to make
2015-02-14 21:05:01 PST [7665-6] DEBUG:  proc_exit(1): 0 callbacks to make
2015-02-14 21:05:01 PST [7665-7] DEBUG:  exit(1)

一,当我指定 conf 文件时,我不知道auto.conf它在寻找什么文件。

但是...(编辑为我认为合适的行[s])

$ sudo gedit /etc/postgresql/9.4/main/pg_hba.conf 

local   all             postgres        127.0.0.1               peer

(我在没有工作后添加了本地IP。仍然不起作用。)

和 ( /etc/postgresql/9.4/main/)

-rw-r--r-- 1 postgres postgres   315 Feb 14 20:20 environment
-rw-r--r-- 1 postgres postgres   143 Feb 14 20:20 pg_ctl.conf
-rw-r----- 1 postgres postgres  4641 Feb 14 20:55 pg_hba.conf
-rw-r----- 1 postgres postgres  4641 Feb 14 20:20 pg_hba.conf~
-rw-r----- 1 postgres postgres  1636 Feb 14 20:20 pg_ident.conf
-rw-r--r-- 1 postgres postgres 21461 Feb 14 20:20 postgresql.conf
-rw-r--r-- 1 postgres postgres   378 Feb 14 20:20 start.conf

在我看来,配置文件归postgres. 是什么赋予了?

更新(晚上 9 点 30 分)

运行以下命令 (as postgres) 给出相同的结果。

$ su - postgres; /usr/lib/postgresql/9.4/bin/postgres -d 3 -D /var/lib/postgresql/9.4/main -c config_file=/etc/postgresql/9.4/main/postgresql.conf
4

1 回答 1

1

从错误消息来看,数据目录的所有权似乎配置错​​误。如果是这样,请使用(作为特权系统用户)修复:

chown postgres:postgres /var/lib/postgresql/9.4
chown postgres:postgres /var/lib/postgresql/9.4/main

-R如果这些目录中的任何内容由不同的用户拥有,请使用“递归”选项。

于 2015-02-15T05:44:17.783 回答