2013-08-18 102 views
0

我以前使用EnterpriseDB安裝程序在我的Mac上安裝了PostgreSQL 9.2。因此,我修改了.bash_profile來讀取export PATH=/opt/local/lib/postgresql92/bin:$PATH,並且一切正常。系統恢復後PostgreSQL服務器不會啓動; OSX Mountain Lion

然後我有一個硬盤驅動器損壞,不得不重新格式化我的電腦,並重新安裝OSX。最初我不得不重新安裝Snow Leopard(這是我有的恢復光盤的版本),然後重新升級到Mountain Lion(我在崩潰之前運行)。然後,我使用帶有遷移助理的Time Machine備份來恢復我的用戶,應用程序和「其他文件」。

環顧四周似乎又回到了崩潰前的地方。但是,現在當我嘗試做任何事情的PostgreSQL相關的,我得到的錯誤:

psql: could not connect to server: No such file or directory 
    Is the server running locally and accepting 
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 

讀圍繞網上我發現,因爲當我執行系統恢復我的PostgreSQL服務器尚未啓動,這可能是簡單的。官方文檔說使用下面的命令:

$ postgres -D /usr/local/pgsql/data

但是我沒有在/usr/local/pgsql一個文件夾; data我可以找到的唯一目錄是/Library/PostgreSQL/9.2/data。所以我切換到postgressudo su postgres,並試圖再次postgres -D /Library/PostgreSQL/9.2/data,這些都給:

2013-08-18 11:38:09 SGT FATAL: could not create shared memory segment: Invalid argument 
2013-08-18 11:38:09 SGT DETAIL: Failed system call was shmget(key=5432001, size=32374784, 03600). 
2013-08-18 11:38:09 SGT HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 32374784 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections. 
    If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for. 
    The PostgreSQL documentation contains more information about shared memory configuration. 

我在哪裏何去何從?這整件事有點奇怪,我不記得曾經有當我最初安裝的PostgreSQL啓動服務器...

編輯:我也嘗試過initdb -D /Library/PostgreSQL/9.2/data的情況下,該數據庫集羣失蹤,但得到:

initdb: directory "/Library/PostgreSQL/9.2/data" exists but is not empty 
If you want to create a new database system, either remove or empty 
the directory "/Library/PostgreSQL/9.2/data" or run initdb 
with an argument other than "/Library/PostgreSQL/9.2/data". 

所以它應該仍然存在,與我係統上的其他東西一起恢復,對吧?

+0

你有一個流浪的'postmaster.pid'文件在哪裏踢? –

+0

@ muistooshort,我在'/ Library/PostgreSQL/9.0/data'中有一個,但是之前卸載了該版本的PostgreSQL(由於屬於'postgres','data'目錄是'9.0'內唯一留下的'我的普通用戶)。雖然在'9.2/data'中沒有這樣的文件。 – GChorn

回答

0

您的內核參數需要調整。以下是有關kernel resources的相關文檔。根據你的系統規格(內存)進行配置,你應該很好。

作爲腳註,我想補充一點,從Postgresql 9.3開始,上面的調整將會是no longer be necessary

+0

我實際上可以通過簡單地運行卸載程序然後重新安裝PostgreSQL來解決問題,但是感謝您的回答。我相信它將在未來有用。 – GChorn

相關問題