手工啓動:
[postgres@develop ~]$ pg_start
server starting
[postgres@develop ~]$ps -ef|grep postgres
發現仍是沒起來,查看日誌,裏面有如此報錯信息: sql
[postgres@develop ~]$ tail -f pg_log FATAL: data directory "/home/postgres/data" has wrong ownership HINT: The server must be started by the user that owns the data directory. FATAL: data directory "/home/postgres/data" has wrong ownership HINT: The server must be started by the user that owns the data directory. FATAL: data directory "/home/postgres/data" has wrong ownership HINT: The server must be started by the user that owns the data directory. FATAL: data directory "/home/postgres/data" has group or world access DETAIL: Permissions should be u=rwx (0700). |
再啓動
[postgres@develop ~]$ pg_start
server starting
正常了。後來瞭解到是開發的一個誤操做,改其餘文件的權限的時候把DB文件的用戶組權限也改了 。
總結:
默認狀況下,PostgreSQL啓動時,啓動DB用戶必須擁有數據文件的所屬權限(user權限),且權限不能過大,不然就會報上述錯誤。其實這是一個安全的保護措施,防止DB文件由於權限開設太大而被其餘非容許的用戶訪問。 tomcat