您好,登錄后才能下訂單哦!
線上的一套MySQL 5.6的從庫,因為OOM而導致數據庫重啟。
# tail -50 /var/log/messages Nov 13 16:00:40 app-push-db2 kernel: Out of memory: Kill process 26121 (mysqld) score 957 or sacrifice child Nov 13 16:00:40 app-push-db2 kernel: Killed process 26121 (mysqld) total-vm:18804176kB, anon-rss:15541596kB, file-rss:0kB, shmem-rss:0kB
報錯原因:
這臺實例所在的服務器上面部署了單實例MySQL,物理內存為16G,分配給數據庫的緩存innodb_fuffer_pool_size為12G。
# free -g total used free shared buff/cache available Mem: 15 10 0 0 5 4 Swap: 0 0 0
為了提高性能,這臺實例關閉了磁盤的swap交換。
# cat /etc/rc.local #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. touch /var/lock/subsys/local swapoff -a
當客戶端連接多的時候,導致內存資源耗盡。
解決方法:
將innodb_buffer_pool_size調整為10G,預留出一些內存給操作系統和客戶端連接。
重啟數據庫,使參數生效。
# grep innodb_buffer_pool /etc/my.cnf innodb_buffer_pool_size=10G
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。