閱讀102 返回首頁    go 人物


服務器負載暴漲以後

打開nagios監控見麵,發現3個服務器(3個服務器處於同一個集群下,業務為論壇,同時在線人數大概4萬人)的load過高,處於warning狀態 1、 先查看訪問流量,通過對比,跟以前沒什麼差別。 2、 查看每個服務器的進程數和cpu使用情況,跟以前也沒什麼差別。 3、 查看係統日誌,每個服務器都有“TCP: Treason uncloaked! Peer 113.247.241.146:21345/80 shrinks window 2128147967:2128149427. Repaired.” 4、 查看php日誌,大量“[WARNING] fpm_request_check_timed_out(), line 158: child 25379, script ‘/mnt/html/bbs/forum.php’ (pool default) execution timed out (120.306361 sec), terminating”。打開論壇首頁,居然花了120多秒。我在php配置文件裏設置的執行中斷時間是120秒,超過這個值則關閉該子進程。看來應該從這裏下手了。   先問問其他人,最近有沒有改程序,有沒有加插件?答:“沒有”。我再仔細檢查了係統: (1)       查看有沒有文件係統損壞而不能寫入 (2)       查看分區是否滿(實際上滿了的話,有短信報警的) (3)       查看tcp連接狀態,還沒以前多呢,看來不是係統的問題   那麼,與之有關聯的還有數據庫、nfs文件係統以及memchached。先檢查容易的,好!先檢查nfs,正常;再檢查memcached,正常。看來估計數據庫有什麼問題了。   登錄數據庫,先查看數據庫錯誤日誌,tail –f 一下,滾動輸出,看來問題找到了。輸入的內容主要有一下幾行:

 

[ERROR] Got error 134 when reading table ‘./uc_mumayi/cdb_uc_members’ [ERROR] Got error 134 when reading table ‘./uc_mumayi_net/cdb_uc_members’ [ERROR] /usr/local/mysql/libexec/mysqld: The table ‘pre_common_session’ is full

 

接下來,從處理表滿開始,把它的行數值設置巨大一點,我設置的是1000萬,指令為:mysql>ALTER TABLE pre_common_session MAX_ROWS=10000000; 完畢後3個web服務器的負載馬上就下降了。從報錯信息中,可以判斷有2個表可能損壞了。檢查一下,如果真壞了,就修複一下吧! (1)檢查第一個表:mysql> check table cdb_uc_notelist;輸出為+—————————+——-+———-+———————————————————–+ | Table                     | Op    | Msg_type | Msg_text                                                  | +—————————+——-+———-+———————————————————–+ | uc_mumayi.cdb_uc_notelist | check | warning | 11 clients are using or haven’t closed the table properly | | uc_mumayi.cdb_uc_notelist | check | warning | Size of datafile is: 260372       Should be: 259760       | | uc_mumayi.cdb_uc_notelist | check | error    | Wrong bytesec: 101-114-110 at linkstart: 258412           | | uc_mumayi.cdb_uc_notelist | check | error    | Corrupt                                                   | +—————————+——-+———-+———————————————————–+ 4 rows in set (0.04 sec) 真損壞了,修複一把:mysql> repair table cdb_uc_notelist; 輸出為+—————————+——–+———-+———————————————–+ | Table                     | Op     | Msg_type | Msg_text                                      | +—————————+——–+———-+———————————————–+ | uc_mumayi.cdb_uc_notelist | repair | info     | Wrong bytesec: 101-114-110 at 258412; Skipped | | uc_mumayi.cdb_uc_notelist | repair | warning | Number of rows changed from 5715 to 5742      | | uc_mumayi.cdb_uc_notelist | repair | status   | OK                                            | +—————————+——–+———-+———————————————–+ (2)修複第2個表,方法同上。 (3)再次檢查表狀態。 文章來源於>>站長天空

最後更新:2017-01-04 22:34:54

  上一篇:go Oracle與MySQL的幾點區別
  下一篇:go Apache的曆史