我想在 Cloud9 中为我的 Rails 应用设置 postgresql。
修改文件后出现如下错误
sudo service postgresql start
* Starting PostgreSQL 9.3 database server
* The PostgreSQL server failed to start. Please check the log output:
2016-04-09 23:49:54 UTC LOG: invalid connection type "PostgreSQL"
2016-04-09 23:49:54 UTC CONTEXT: line 1 of configuration file "/etc/postgresql/9.3/main/pg_hba.conf"
2016-04-09 23:49:54 UTC FATAL: could not load pg_hba.conf
...fail!
数据库.yml
default: &default
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
username: ubuntu
password: password
development:
<<: *default
database: app_development
test:
<<: *default
database: app_test
production:
<<: *default
database: app_production
/etc/postgresql/9.3/main/pg_hba.conf
PostgreSQL Client Authentication Configuration File
...
# Database administrative login by Unix domain socket
local localhost postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all ubuntu peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
...
如果你能告诉我如何避免这个错误,我将不胜感激。
最佳答案
这可能是由于配置文件中的无效条目所致。尝试使用
重新加载它pg_ctl reload -D $PGDATA
还假设您的 gemfile 中有 gem 'pg'
关于ruby-on-rails - PostgreSQL 服务器无法在 Cloud9 中启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36524209/