2013-10-10 40 views
0

今天早上我注意到我的mysql服務器沒有運行。看看日誌,我找到了下面的信息。雖然mysqld服務耗盡內存並被殺死令人不安,但更麻煩的是mysql無法重啓。mysql以狀態1結束?

關於爲什麼mysql無法重新生成的任何想法?我如何測試以確保如果進程被殺死,它會重新生成?

謝謝。

387 Oct 10 06:37:09 ip-xxx-xxx-xxx-xxx kernel: [12218775.475042] Out of memory: Kill process 810 (mysqld) score 232 or sacrifice child 
388 Oct 10 06:37:09 ip-xxx-xxx-xxx-xxx kernel: [12218775.475060] Killed process 810 (mysqld) total-vm:888108kB, anon-rss:139816kB, file-rss:0kB 
389 Oct 10 06:37:09 ip-xxx-xxx-xxx-xxx kernel: [12218775.655663] init: mysql main process (810) killed by KILL signal 
390 Oct 10 06:37:09 ip-xxx-xxx-xxx-xxx kernel: [12218775.655745] init: mysql main process ended, respawning 
391 Oct 10 06:37:10 ip-xxx-xxx-xxx-xxx kernel: [12218776.044805] type=1400 audit(1381408630.181:13): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=27754 comm="apparmor_parser" 
392 Oct 10 06:37:10 ip-xxx-xxx-xxx-xxx kernel: [12218776.676434] init: mysql main process (27763) terminated with status 1 
393 Oct 10 06:37:10 ip-xxx-xxx-xxx-xxx kernel: [12218776.676489] init: mysql main process ended, respawning 
394 Oct 10 06:37:11 ip-xxx-xxx-xxx-xxx kernel: [12218777.468923] init: mysql post-start process (27764) terminated with status 1 
395 Oct 10 06:37:11 ip-xxx-xxx-xxx-xxx kernel: [12218777.512363] type=1400 audit(1381408631.649:14): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=27800 comm="apparmor_parser" 
396 Oct 10 06:37:11 ip-xxx-xxx-xxx-xxx kernel: [12218777.681433] init: mysql main process (27804) terminated with status 1 
397 Oct 10 06:37:11 ip-xxx-xxx-xxx-xxx kernel: [12218777.681491] init: mysql respawning too fast, stopped 

回答

0

一個老問題,但一個反覆出現的問題。這個問題有兩個面:

  • 首先,爲什麼mysql進程內存不足?
  • 其次,爲什麼mysql進程無法重新啓動?

第一個是在配置中的一個矯枉過正的東西。超大的緩衝區配置可以使MySQL要求更多的內存,而不是系統可以提供的內存。驗證this question以獲得有關如何找到最適合您的環境的見解。

第二個問題可能非常棘手。有很多可能會阻止mysql啓動的問題。可以執行以下步驟來找出原因。 第一條線索可以在mysql日誌錯誤文件中找到,大多數情況下可以在/var/log/mysql/error.log中找到 但是,無論問題的性質如何,錯誤日誌文件都可以爲空。在這種情況下嘗試:

  1. 外觀到系統日誌:在終端提示

    type tail -f /var/log/syslog 
    

    ,並在另一端嘗試啓動mysql:

    service start mysql 
    

如果這種方法不要提供任何有用的線索嘗試以下內容:

  1. 開始從在詳細模式生的mysqld:

    su mysql 
    mysqld -v 
    

作爲顯示here

輸出消息有助於找出阻止mysql啓動的根本原因。