1
我想爲我的rails應用程序在Cloud9中設置postgresql。PostgreSQL服務器無法在Cloud9中啓動
更改某個文件後顯示以下錯誤。
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!
的database.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
...
如果你能告訴我將不勝感激如何避免這個錯誤。
謝謝您的回答,@Abhilash。雖然我嘗試了這個命令,但是出現了下面的錯誤。 'bash:pg_ctl:command not found'並且在我的gemfile中有'gem'pg','〜> 0.18.2''。 – SamuraiBlue
也許你需要初始化目錄..爲此,你可以嘗試'initdb〜/ .postgres'和'pg_ctl -D〜/ .postgres start' ..但是我從來沒有必要在cloud9之前... – Abhilash
謝謝你的評論,@Abhilash。刪除'/ etc/postgresql/9.3/main/pg_hba.conf'中的第一行後,不顯示任何錯誤。 – SamuraiBlue