偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

詳解MySQL數(shù)據(jù)庫資源不足的異常錯誤

數(shù)據(jù)庫 MySQL
MySQL是一個線程管理型的系統(tǒng), 通過Linux系統(tǒng)的ps -ef無法正常發(fā)現(xiàn)其占用的進程數(shù),在無法登錄mysql用戶或者登錄進入mysql的情況下, 可以通過查看proc文件系統(tǒng)檢查系統(tǒng)的情況。

前幾天,在管理系統(tǒng)的時候遇到一個奇怪的問題, 今天才有機會安裝好MySQL環(huán)境來重現(xiàn)此問題,由于不是最原始的環(huán)境, 所以未必能夠完全重現(xiàn), 我只能努力重現(xiàn)關(guān)鍵問題了.. 我覺得此問題有點特別, 故在此大概的回想下當時的情景..

工作時, 執(zhí)行了一個su – mysql 的命令, 遇到了下面這樣一個錯誤..

  1. [root@dbmain ~]# su - mysql   
  2. su: cannot set user id: Resource temporarily unavailable  

這是一個Shell中由于資源不足引起的問題, 當時下意識的先運行ulimit,看看ulimit的基本限制.

  1. [root@dbmain ~]# ulimit -a   
  2. core file size          (blocks, -c) 0   
  3. data seg size           (kbytes, -d) unlimited   
  4. scheduling priority             (-e) 0   
  5. file size               (blocks, -f) unlimited   
  6. pending signals                 (-i) 25600   
  7. max locked memory       (kbytes, -l) 32   
  8. max memory size         (kbytes, -m) unlimited   
  9. open files                      (-n) 1024   
  10. pipe size            (512 bytes, -p) 8   
  11. POSIX message queues     (bytes, -q) 819200   
  12. real-time priority              (-r) 0   
  13. stack size              (kbytes, -s) 10240   
  14. cpu time               (seconds, -t) unlimited   
  15. max user processes              (-u) 25600   
  16. virtual memory          (kbytes, -v) unlimited   
  17. file locks                      (-x) unlimited 

又看了看,/etc/security/limits.conf

  1. oracle              soft    nproc   2047   
  2. oracle              hard    nproc   16384   
  3. oracle              soft    nofile  1024   
  4. oracle              hard    nofile  65536   
  5. oracle              soft    memlock        12582912   
  6. oracle              hard   memlock        12582912   
  7. grid              soft    nproc   2047   
  8. grid              hard    nproc   16384   
  9. grid              soft    nofile  1024   
  10. grid              hard    nofile  65536   
  11. grid              soft    memlock        12582912   
  12. grid              hard   memlock        12582912   
  13. mysql             soft    nproc  500   
  14. mysql             hard    nproc  500   
  15. mysql             soft    nofile  1024   
  16. mysql             hard    nofile  65536   
  17. mysql             soft    memlock  12582912   
  18. mysql             hard    memlock  12582912 

經(jīng)過分析,懷疑也只有process/file這兩個出現(xiàn)資源緊張的概率比較大.. 因此就先ps -ef 看系統(tǒng)中該用戶的進程數(shù)量..

  1. [root@dbmain ~]# ps -ef | grep mysql   
  2. root      4733     1  0 10:30 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/dbmain.pid   
  3. mysql     4788  4733  0 10:30 ?        00:00:04 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/dbmain.err --pid-file=/var/lib/mysql/dbmain.pid   
  4. root     15171 17507  0 13:26 pts/2    00:00:00 mysql -uroot -p   
  5. root     20792 17163  0 15:30 pts/1    00:00:00 grep mysql 

從這個輸出,,我們暫時排除nproc超標的可能性.

由此, 就根據(jù)此進程的pid進入其proc目錄查看當前打開的文件數(shù)量..

發(fā)現(xiàn)有大量socket的文件連接.. 但是其數(shù)量遠遠未達到文件數(shù)的限制, 由此懷疑可能是MySQL的線程也會消耗掉Linux系統(tǒng)的nproc基數(shù), 因此嘗試調(diào)整/etc/security/limits.conf文件的nproc參數(shù)的值.

發(fā)現(xiàn)調(diào)整過后, su – mysql 確實可以成功執(zhí)行了,,后面又將此參數(shù)改回, 重新執(zhí)行su – mysql,,此問題又再次重現(xiàn)..由此確認,,使用MySQL的系統(tǒng), 在設置MySQL的參數(shù)max_connections之外, 還需要考慮設置/etc/security/limits.conf文件的大小, MySQL是線程模式執(zhí)行的, 其線程數(shù)也會被統(tǒng)計在nproc中, 這可能掩蓋或造成對此問題的誤判..

【編輯推薦】 

  1. MySQL數(shù)據(jù)庫集群進行正確配置步驟
  2. MySQL 集群在Server1與Server2上如何安裝MySQL
  3. MySQL集群配置
  4. MySQL集群自動安裝腳本
  5. MySQL觸發(fā)器如何正確使用
責任編輯:彭凡 來源: DBhome
相關(guān)推薦

2011-04-07 15:47:28

MySQL數(shù)據(jù)庫

2010-03-29 10:19:24

2011-07-12 16:41:14

mysql處理異常

2018-07-30 15:00:05

數(shù)據(jù)庫MySQLJOIN

2022-03-29 10:52:08

MySQL數(shù)據(jù)庫

2010-06-02 11:24:57

MySQL數(shù)據(jù)庫主鍵

2011-05-26 14:43:49

ORACLE數(shù)據(jù)庫異常處理

2011-08-30 12:51:19

MySQL線程緩沖池

2011-08-05 14:02:17

MySQL數(shù)據(jù)庫異常處理

2010-06-10 17:19:05

MySQL數(shù)據(jù)庫

2011-09-01 10:56:34

2010-01-05 09:24:42

MySQL外鍵約束

2011-08-30 13:40:28

MySQL線程

2011-08-25 17:49:14

MySQLmysqlcheck

2010-05-19 13:37:39

MySQL數(shù)據(jù)庫密碼

2011-08-22 18:12:20

OracleORA-01591

2011-08-17 17:29:32

Windows編譯MySQL

2010-06-11 14:46:13

MySQL數(shù)據(jù)庫

2009-12-31 11:10:01

2009-09-07 15:25:24

MySQL數(shù)據(jù)庫互操作Silverlight
點贊
收藏

51CTO技術(shù)棧公眾號