您好,登錄后才能下訂單哦!
環(huán)境zabbix 4.0 + pgpool + postgres 11.0 cluster + Centos 7.5 +Python2.7.5【3.6】
引起故障的原因,PG Master 磁盤空間150G,由于zabbix監(jiān)控設(shè)備眾多(約1000個(gè)點(diǎn),模板監(jiān)控項(xiàng)也較多),導(dǎo)致數(shù)據(jù)庫的歸檔文件增長速度非常快,通常五分鐘左右吃掉一個(gè)G的空間。磁盤空間消耗完畢之后,pg&pgpool的服務(wù)會(huì)停止,進(jìn)而影響zabbix系統(tǒng)的使用.為了解決這個(gè)問題,創(chuàng)建了bash shell 腳本和crontab 任務(wù)定時(shí)清理歸檔文件.
1. 登錄 postgres : docker run -ti postgres /bin/bash【不是docker環(huán)境直接跳過此步驟】
2. 切換到 postgres 用戶
3. 執(zhí)行修復(fù)命令:/usr/pgsql-11/bin/pg_resetwal -f /var/lib/pgsql/11/data
【根據(jù)環(huán)境和安裝方式的不同,可能文件路徑不同,具體可以使用locate或find 命令搜索 pg_resetwal】
【pg_resetxlog -f DATADIR postgres 低于10.0 以下的版本可以使用該命令;-f 強(qiáng)制執(zhí)行更新】
4. 如果看到“Write-ahead log reset”,表示修復(fù)成功。
# systemctl start postgresql-11.service
# systemctl status postgresql-11.service
# systemctl start pgpool-II-11.service
# systemctl status pgpool-II-11.service
# netstat -pltn
此時(shí)PG的服務(wù)起來了,但是未必?cái)?shù)據(jù)庫可以正常使用,繼續(xù)使用命令檢查
-bash-4.2$ psql
psql: FATAL: xlog flush request 399/FCA1D7D8 is not satisfied --- flushed only to 399/E720DE18
CONTEXT: writing block 2225 of relation base/16385/17835
--此時(shí)報(bào)的這個(gè)錯(cuò)誤,可以耐心等待一段時(shí)間(約十幾分吧),經(jīng)驗(yàn)而談pg和pgpool從故障恢復(fù)過來都要等一段時(shí)間才可正常使用;
-bash-4.2$ psql
psql (11.4)
Type "help" for help.
postgres=#
備注:只需要點(diǎn)擊紅色箭頭所指“返回/斷開連接” & "重新加載“”,集群業(yè)務(wù)即可恢復(fù)使用,比命令行管理方便已維護(hù);
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。