重新啟動postgre報錯時,解決方案 ( 由備份檔案佔用空間太大造成 ) (linux 命令 df -h 查看磁碟空間)__linux

來源:互聯網
上載者:User

在這裡使用了一個liunx下的命令查看磁碟空間

df: disk free  http://www.cnblogs.com/chenwenbiao/archive/2011/08/07/2129831.html

常用參數:df -h

-------------------------------------

1.在Linux下重新啟動postgre

pg_ctl restart (postgres 使用者)

今天遇到的問題

由於匯入資料,造成資料庫不斷產生備份檔案,佔滿了空間

無法繼續啟動。

解決方案:

備份檔案所在目錄結構

root

   databases

       archieves

       data

       pg_xlog

           archive_status

(archieves 檔案;檔案;記錄)

刪除這些目錄下面的資料備份檔案

-------------------------------------------------------------------------------

錯誤現象

執行pg_ctl restart命令

報錯

could not change directory to "/root"

pg_ctl:PID file "/database/data/postmaster.pid" does not exist

出現這種問題的原因

不是因為目錄下沒有這個檔案,而是因為磁碟空間太小

進程執行時,沒有足夠的空間來讀取這個檔案。

使用postgres使用者執行以下命令

df -h可以查看資料庫的空間的使用狀況

FIlesystem     size   used   avail    Use%   Mounted on                     

/dev/sda3        70     70         0       100         /                                    

進程沒有足夠的空間來運行,所以出現了上面的錯誤

----------------------------------------------------

問題產生

使用預存程序對postgre插入資料

每次插入10萬條資料,由此在上面的那些目錄產生了n多的備份檔案

這些備份檔案佔用了大量的磁碟空間

當最後一次執行這個批處理命令時

控制台報錯,說磁碟空間不足,緊接著這邊就再也串連不上資料庫了

查看進程,發現postgre的進程已經停掉

重新啟動時,就報了上面的那個錯誤

could not change directory to "/root"

pg_ctl:PID file "/database/data/postmaster.pid" does not exist

----------------------------------------

注意:

是什麼吃掉了磁碟空間

是備份檔案吃掉的巨大的磁碟空間

其實,那幾百萬條資料並沒有佔用多少磁碟空間

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.