2013-06-01 72 views
0

我知道這個問題已經討論過,但沒有任何答案對我有幫助。對不起,爲了開始一個新的話題...並感謝任何人的幫助。Postgres在127.0.0.1停止連接

我一直在我的本地機器上每天都在開發......它不是一個新的設置,但突然服務器不會連接......並不知道爲什麼。

我的原始安裝postgres是通過自制軟件。我使用pg gem version 0.15.1,ruby 2.0,rails 3.2.13,postgres 9.2.4。

$束EXEC軌小號

=> Booting Thin 
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
Exiting 

/Users/Hank/.rvm/gems/[email protected]/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize': could not connect to server: Connection refused (PG::Error) 

Is the server running on host "localhost" (::1) and accepting 
TCP/IP connections on port 5432? 
    could not connect to server: Connection refused 

    Is the server running on host "localhost" (127.0.0.1) and accepting 
TCP/IP connections on port 5432? 
    could not connect to server: Connection refused 

    Is the server running on host "localhost" (fe80::1) and accepting 
TCP/IP connections on port 5432? 

$沖泡信息Postgres的

postgresql: stable 9.2.4 

通常當我得到任何服務器錯誤,我可以強制停止或重新啓動,然後重新啓動我的機器,一切都很好。這一次,我嘗試了一堆pg_ctl命令,重新啓動,重建權限並運行光盤實用程序,gem pristine pg,卸載pg,重新安裝pg,brew update postgres,將刪除.pid文件,但目前沒有創建一個.pid文件。

$ Postgres的這

/usr/local/bin/postgres 

$其中PSQL

/usr/local/bin/psql 

$的ps aux | grep postgres

returns: 1976 0.0 0.0 2430992 1584 s000 R+ 8:54PM 0:00.01 grep postgres 
+0

錯誤消息和'ps'輸出表明PostgreSQL沒有運行。你嘗試過'pg_ctl start'嗎?如果你有,它說了什麼? –

+0

它返回... pg_ctl:沒有指定數據庫目錄和環境變量PGDATA未設置 嘗試「pg_ctl --help」以獲取更多信息。 – hellion

+0

和pg_ctl -D/Library/PostgreSQL/data start返回 - 服務器啓動 - postgres無法訪問服務器配置文件「/Library/PostgreSQL/data/postgresql.conf」:沒有這樣的文件或目錄 – hellion

回答

0

我已經安裝了新的postgres.app,它基本上控制了pg環境。我忘了所有關於它的信息,並且出於某種原因,該應用程序在我的計算機啓動時停止了自動啓動服務器。所以,忘記了應用程序......並且它沒有自動加載......我無法弄清楚爲什麼我無法控制我的pg服務器以及爲什麼我無法啓動它。

PS - postgres.app很棒!只要你不忘記使用它...