欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

包含postgresql打開的詞條

PostgreSQL服務(wù)器啟動(dòng)及關(guān)閉方法

1. 啟動(dòng)數(shù)據(jù)庫(kù)服務(wù)器(posgres用戶):

成都創(chuàng)新互聯(lián)專注于企業(yè)成都營(yíng)銷網(wǎng)站建設(shè)、網(wǎng)站重做改版、新建網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5網(wǎng)站設(shè)計(jì)電子商務(wù)商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營(yíng)銷網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為新建等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

[postgres@localhost bin]$ postgres -D /opt/postgresql/data/ /opt/postgresql/log/pg_server.log 21

[1] 4508

當(dāng)然如果設(shè)置了環(huán)境變量

PGDATA=/opt/postgresql/data

export PGDATA

后,可使用pg_ctl工具進(jìn)行啟動(dòng):

[postgres@localhost log]$ pg_ctl start -l /opt/postgresql/log/pg_server.log

pg_ctl: another server might be running; trying to start server anyway

pg_ctl: could not start server

Examine the log output.

[postgres@localhost log]$

因?yàn)橹耙呀?jīng)啟動(dòng),所以打印“another server might be running”。此時(shí),查看日志,有如下信息:

[postgres@localhost log]$ cat pg_server.log

FATAL: lock file "postmaster.pid" already exists

HINT: Is another postmaster (PID 4491) running in data directory "/opt/postgresql/data"?

[postgres@localhost log]$

當(dāng)然,最簡(jiǎn)的.啟動(dòng)方式是:

[postgres@localhost ~]$ pg_ctl start

server starting

[postgres@localhost ~]$ LOG: database system was shut down at 2011-07-09 13:58:00 CST

LOG: autovacuum launcher started

LOG: database system is ready to accept connections

如果要在操作系統(tǒng)啟動(dòng)時(shí)就啟動(dòng)PG,可以在/etc/rc.d/rc.local 文件中加以下語(yǔ)句:

/opt/postgresql/bin/pg_ctl start -l /opt/postgresql/log/pg_server.log -D /opt/postgresql/data

2.關(guān)閉服務(wù)器

最簡(jiǎn)單方法:

[postgres@localhost ~]$ pg_ctl stop

waiting for server to shut down.... done

server stopped

與Oracle相同,在關(guān)閉時(shí)也可采用不同的模式,簡(jiǎn)介如下:

SIGTERM

不再允許新的連接,但是允許所有活躍的會(huì)話正常完成他們的工作,只有在所有會(huì)話都結(jié)束任務(wù)后才關(guān)閉。這是智能關(guān)閉。

SIGINT

不再允許新的連接,向所有活躍服務(wù)器發(fā)送 SIGTERM(讓它們立刻退出),然后等待所有子進(jìn)程退出并關(guān)閉數(shù)據(jù)庫(kù)。這是快速關(guān)閉。

SIGQUIT

令 postgres 向所有子進(jìn)程發(fā)送 SIGQUIT 并且立即退出(所有子進(jìn)程也會(huì)立即退出),而不會(huì)妥善地關(guān)閉數(shù)據(jù)庫(kù)系統(tǒng)。這是立即關(guān)閉。這樣做會(huì)導(dǎo)致下次啟動(dòng)時(shí)的恢復(fù)(通過(guò)重放 WAL 日志)。我們推薦只在緊急的時(shí)候使用這個(gè)方法。

SIGKILL

此選項(xiàng)盡量不要使用,這樣會(huì)阻止服務(wù)器清理共享內(nèi)存和信號(hào)燈資源,那樣的話你只能在啟動(dòng)服務(wù)器之前自己手工做這件事。另外,SIGKILL 直接把 postgres 殺掉,而不會(huì)等它把信號(hào)中繼給它的子進(jìn)程,因此我們還需要手工殺掉每個(gè)獨(dú)立子進(jìn)程。

使用方法舉例:

[postgres@localhost ~]$ pg_ctl stop -o SIGTERM

LOG: received smart shutdown request

LOG: autovacuum launcher shutting down

waiting for server to shut down....LOG: shutting down

LOG: database system is shut down

done

server stopped

[postgres@localhost ~]$

最快速關(guān)閉方法:kill postgres 進(jìn)程

[postgres@localhost ~]$ kill -INT `head -1 /opt/postgresql/data/postmaster.pid`

[postgres@localhost ~]$ LOG: received fast shutdown request

LOG: aborting any active transactions

LOG: autovacuum launcher shutting down

LOG: shutting down

LOG: database system is shut down

附:postgre啟動(dòng)后的進(jìn)程,如下:

[postgres@localhost ~]$ ps -ef|grep post

root 4609 4543 0 13:57 pts/2 00:00:00 su - postgres

postgres 4610 4609 0 13:57 pts/2 00:00:00 -bash

postgres 4724 1 0 14:08 pts/2 00:00:00 /opt/postgresql/bin/postgres

postgres 4726 4724 0 14:08 ? 00:00:00 postgres: writer process

postgres 4727 4724 0 14:08 ? 00:00:00 postgres: wal writer process

postgres 4728 4724 0 14:08 ? 00:00:00 postgres: autovacuum launcher process

postgres 4729 4724 0 14:08 ? 00:00:00 postgres: stats collector process

postgres 4752 4610 0 14:11 pts/2 00:00:00 ps -ef

postgres 4753 4610 0 14:11 pts/2 00:00:00 grep post

[postgres@localhost ~]$

如何用命令打開postgresql數(shù)據(jù)庫(kù)

F:\PostgreSQL\9.2\binpsql.exe

-h

localhost

-U

postgres

-d

Test

-p

5432psql

(9.2.4)輸入

"help"

來(lái)獲取幫助信息.Test=#Test=#

help;您正在使用psql,

這是一種用于訪問(wèn)PostgreSQL的命令行界面鍵入:

\copyright

顯示發(fā)行條款

\h

顯示

SQL

命令的說(shuō)明

\?

顯示

pgsql

命令的說(shuō)明

\g

或者以分號(hào)(;)結(jié)尾以執(zhí)行查詢

\q

退出注:

數(shù)據(jù)庫(kù)名稱區(qū)分大小寫的。使用某些有密碼的用戶的情況下,

會(huì)提示輸入密碼.F:\PostgreSQL\9.2\binpsql.exe

-h

localhost

-U

test

-d

Test

-p

5432用戶

test

的口令:psql

(9.2.4)輸入

"help"

來(lái)獲取幫助信息.Test=#

postgresql無(wú)法正常啟動(dòng)的原因追查

仔細(xì)分析,無(wú)非幾個(gè)原因:

1、log目錄的權(quán)限問(wèn)題,比如log文件指定的目錄postgres用戶無(wú)權(quán)寫入,因此沒(méi)有產(chǎn)生任何log文件。檢查了/var/lib/postgresql/11/main的目錄,沒(méi)有發(fā)現(xiàn)問(wèn)題。

2、配置文件的權(quán)限問(wèn)題,檢查了/etc/postgresql/11/main目錄,也沒(méi)有發(fā)現(xiàn)任何問(wèn)題,postgres用戶是有權(quán)限讀取配置文件的。

3、配置文件有錯(cuò)誤導(dǎo)致無(wú)法正常啟動(dòng)postgresql。排除了上面的兩個(gè)原因,這個(gè)應(yīng)該是最大的原因了。但是,錯(cuò)誤在哪里呢?沒(méi)有給出提示啊!

?嘗試了service postgresql start, pg_ctrcluster, pg_ctl均無(wú)法給出任何提示,后來(lái)才想明白,這幾個(gè)都是對(duì)postmaster的腳本封裝啊,也許這些封裝忽略了什么重要的信息!應(yīng)該直接運(yùn)行postmaster才能得到直接的出錯(cuò)提示的!果然,執(zhí)行/usr/lib/postgresql/11/bin/下的postmaster給出了提示,執(zhí)行語(yǔ)句:

?看到這里立刻明白了:我將postgresql.conf中的lc_messages改為了 en_US.UTF-8,可是沒(méi)有產(chǎn)生en_US.UTF-8的locale文件啊!于是修改/etc/locales.gen文件添加en_US.UTF-8,執(zhí)行l(wèi)ocales.gen,再次啟動(dòng)postgresql,成功!

Windows系統(tǒng)中有哪些方法開啟Postgresql服務(wù)

我們?cè)谑褂肞ostgresql的時(shí)候,首先需要開啟Postgresql服務(wù)。那么在Windows系統(tǒng)中有哪些方法開啟Postgresql服務(wù)呢?下面我給大家分享一下。

工具/材料

任務(wù)管理器,服務(wù)面板,CMD命令行

服務(wù)面板開啟

01

首先按Win+R組合鍵打開運(yùn)行窗口,在輸入框中輸入services.msc命令,如下圖所示

02

在出現(xiàn)的服務(wù)界面中我們找到postgresql的記錄行,如下圖所示,右鍵單擊選擇啟動(dòng)

03

當(dāng)服務(wù)的狀態(tài)顯示為正在運(yùn)行的時(shí)候則代表postgresql服務(wù)已經(jīng)打開了,如下圖所示

任務(wù)管理器開啟

01

按住鍵盤上的Ctrl+Shift+ESC組合鍵,注意是同時(shí)按下,不是一個(gè)個(gè)按,如下圖所示

02

在彈出的任務(wù)管理器窗口中切換到服務(wù)面板,找到postgresql服務(wù),右鍵單擊選擇開始選項(xiàng),如下圖所示

命令行開啟

01

找到所有程序下面的Windows系統(tǒng),然后點(diǎn)擊命令提示符,如下圖所示

02

另外也可以直接打開運(yùn)行界面輸入CMD命令打開命令提示符界面,如下圖所示

03

在命令提示符中通過(guò)net start命令來(lái)開啟postgresql服務(wù),如下圖所示,注意服務(wù)名一定要寫正確

當(dāng)前題目:包含postgresql打開的詞條
本文路徑:http://www.chinadenli.net/article48/dsdjihp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器網(wǎng)站制作網(wǎng)站收錄手機(jī)網(wǎng)站建設(shè)搜索引擎優(yōu)化

廣告

聲明:本網(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)

微信小程序開發(fā)