這篇文章主要講解了“PostgreSQL數(shù)據(jù)庫(kù)啟動(dòng)時(shí)socket存儲(chǔ)目錄的配置是什么”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“PostgreSQL數(shù)據(jù)庫(kù)啟動(dòng)時(shí)socket存儲(chǔ)目錄的配置是什么”吧!
創(chuàng)新互聯(lián)公司:成立于2013年為各行業(yè)開拓出企業(yè)自己的“網(wǎng)站建設(shè)”服務(wù),為1000多家公司企業(yè)提供了專業(yè)的網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、網(wǎng)頁(yè)設(shè)計(jì)和網(wǎng)站推廣服務(wù), 按需網(wǎng)站設(shè)計(jì)由設(shè)計(jì)師親自精心設(shè)計(jì),設(shè)計(jì)的效果完全按照客戶的要求,并適當(dāng)?shù)奶岢龊侠淼慕ㄗh,擁有的視覺效果,策劃師分析客戶的同行競(jìng)爭(zhēng)對(duì)手,根據(jù)客戶的實(shí)際情況給出合理的網(wǎng)站構(gòu)架,制作客戶同行業(yè)具有領(lǐng)先地位的。
unix_socket_directories參數(shù)默認(rèn)為/tmp,由于該目錄是臨時(shí)目錄,以免誤操作,一般設(shè)置在其他目錄中。
下面把unix_socket_directories設(shè)置為/data/pg12,重新啟動(dòng)
[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
嘗試連接數(shù)據(jù)庫(kù)
[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(默認(rèn)在/tmp下),可使用指定主機(jī)&端口連接
但這樣的連接方式不是本地連接
[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)
設(shè)置參數(shù)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數(shù)據(jù)庫(kù)啟動(dòng)時(shí)socket存儲(chǔ)目錄的配置是什么”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)PostgreSQL數(shù)據(jù)庫(kù)啟動(dòng)時(shí)socket存儲(chǔ)目錄的配置是什么這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
標(biāo)題名稱:PostgreSQL數(shù)據(jù)庫(kù)啟動(dòng)時(shí)socket存儲(chǔ)目錄的配置是什么
當(dāng)前URL:http://aaarwkj.com/article10/gghigo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、網(wǎng)站維護(hù)、網(wǎng)站營(yíng)銷、建站公司、搜索引擎優(yōu)化、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)