ruby-on-rails - PostgreSQL 服务器无法在 Cloud9 中启动

标签 ruby-on-rails postgresql cloud9-ide

我想在 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/

相关文章:

postgresql - Airflow sql炼金术池大小被忽略

php - 如何在 Cloud9 上的 PHP 5.6/7.2 之间切换?

ruby-on-rails-3 - 对于 Rails 3.2.16 中的 Postgres,序列 "setval"操作与 "nextval"的工作方式不同

ruby-on-rails - 如何在Heroku上使用Imagemagick的最新版本?

ruby-on-rails - Rails 将 secret 转换为凭据

ruby-on-rails - Ruby on Rails Sidekiq worker 执行顺序

database - 生产环境中 PostgreSQL 的驱动程序/库解决方案

git - 如何从cloud9推送到github?

javascript - 将 Meteor 与 MongoDB 结合使用

ruby-on-rails - 插入自定义 key :value pair in JSON structure with custom order using jbuilder