久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

PostgreSQL數據庫啟動時socket存儲目錄的配置是什么

152次閱讀
沒有評論

共計 2910 個字符,預計需要花費 8 分鐘才能閱讀完成。

這篇文章主要講解了“PostgreSQL 數據庫啟動時 socket 存儲目錄的配置是什么”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著丸趣 TV 小編的思路慢慢深入,一起來研究和學習“PostgreSQL 數據庫啟動時 socket 存儲目錄的配置是什么”吧!

unix_socket_directories 參數默認為 /tmp,由于該目錄是臨時目錄,以免誤操作,一般設置在其他目錄中。
下面把 unix_socket_directories 設置為 /data/pg12,重新啟動

[pg12@localhost pg120db]$ grep  unix  postgresql.conf 
unix_socket_directories =  /data/pg12  # comma-separated list of directories
#unix_socket_directories =  /tmp  # comma-separated list of directories
#unix_socket_group =   # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
[pg12@localhost pg120db]$ 
[pg12@localhost pg120db]$ pg_ctl restart
pg_ctl: PID file  /data/pgsql/pg120db/postmaster.pid  does not exist
Is server running?
trying to start server anyway
waiting for server to start....2019-11-18 18:17:35.123 CST [15542] LOG: starting PostgreSQL 12.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit
2019-11-18 18:17:35.123 CST [15542] LOG: listening on IPv4 address  0.0.0.0 , port 5432
2019-11-18 18:17:35.123 CST [15542] LOG: listening on IPv6 address  :: , port 5432
2019-11-18 18:17:35.155 CST [15542] LOG: listening on Unix socket  /data/pg12/.s.PGSQL.5432 
2019-11-18 18:17:35.237 CST [15542] LOG: redirecting log output to logging collector process
2019-11-18 18:17:35.237 CST [15542] HINT: Future log output will appear in directory  pg_log .
 done
server started

嘗試連接數據庫

[pg12@localhost pg120db]$ psql -d testdb
psql: error: could not connect to server: 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 ?

提示找不到 socket(默認在 /tmp 下),可使用指定主機 端口連接


但這樣的連接方式不是本地連接

[pg12@localhost ~]$ netstat -anpo|grep psql
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6 0 0 ::1:52206 ::1:5432 ESTABLISHED 16200/psql keepalive (7207.79/0/0)

設置參數 PGHOST,使用本地連接 (PGHOST behaves the same as the host connection parameter.)

[pg12@localhost pg120db]$ export PGHOST=/data/pg12
[pg12@localhost pg120db]$ psql -d testdb
Expanded display is used automatically.
psql (12.0)
Type  help  for help.
[pg12@localhost ~]$ netstat -anpo|grep psql
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
unix 3 [ ] STREAM CONNECTED 876042 15681/psql 
[pg12@localhost ~]$

或者使用 - h 指定為 socket 所在目錄

[pg12@localhost ~]$ psql -h /data/pg12
Expanded display is used automatically.
psql (12.0)
Type  help  for help.
[local:/data/pg12]:5432 pg12@testdb=# 
[pg12@localhost ~]$ netstat -anpo|grep psql
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
unix 3 [ ] STREAM CONNECTED 880596 16309/psql 
[pg12@localhost ~]$

感謝各位的閱讀,以上就是“PostgreSQL 數據庫啟動時 socket 存儲目錄的配置是什么”的內容了,經過本文的學習后,相信大家對 PostgreSQL 數據庫啟動時 socket 存儲目錄的配置是什么這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是丸趣 TV,丸趣 TV 小編將為大家推送更多相關知識點的文章,歡迎關注!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-26發表,共計2910字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 绵竹市| 普安县| 林甸县| 兰溪市| 尚义县| 神农架林区| 景德镇市| 田东县| 普定县| 禄丰县| 凭祥市| 怀宁县| 游戏| 尼木县| 根河市| 南木林县| 新田县| 巍山| 邹平县| 安多县| 天峻县| 武川县| 凌云县| 合川市| 当雄县| 大荔县| 丁青县| 凭祥市| 丰城市| 太仓市| 沙河市| 洛南县| 沁阳市| 乌审旗| 新平| 唐河县| 定兴县| 普定县| 二连浩特市| 乐都县| 新密市|