Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails PostgreSQL错误所有权_Ruby On Rails_Postgresql_Permissions_Postgresql 9.4 - Fatal编程技术网

Ruby on rails PostgreSQL错误所有权

Ruby on rails PostgreSQL错误所有权,ruby-on-rails,postgresql,permissions,postgresql-9.4,Ruby On Rails,Postgresql,Permissions,Postgresql 9.4,我将以我很少使用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/

我将以我很少使用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)
首先,我不知道这个
auto.conf
文件在寻找什么,因为我正在指定conf文件

然而。。。(编辑为我认为合适的行)

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

和(
/etc/postgresql/9.4/main/

在我看来,配置文件属于
postgres
。有什么好处

更新(9:30) 运行以下命令(如
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

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


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

您在未公开的目录中显示文件的所有权,但错误表明
数据目录“/var/lib/postgresql/9.4/main”的所有权错误
。另外,您是否确保在系统用户
postgres
编辑时尝试启动服务器。我的坏消息是没有公开目录。Edited.OK,但谁拥有数据目录?在
/var/lib/postgresql/9.4
/var/lib/postgresql
中使用
ls-la
可以得到什么?
-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
$ 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
chown postgres:postgres /var/lib/postgresql/9.4
chown postgres:postgres /var/lib/postgresql/9.4/main