« [ZT]How to Repair a Corrupt MBR and boot into Linux | 首 页 | 一个去了美国几天的留学生的blog »

2006 年 09 月 16 日

Trouble Shooting: kernel: Out of Memory: Killed process 123456 (mysqld)

| 分类: 服务器技术 Server Tech. |

现象:

# tail /var/log/messages
Sep 11 00:37:11 blog kernel: Out of Memory: Killed process 27089 (mysqld).
Sep 11 00:37:11 blog kernel: Out of Memory: Killed process 27104 (mysqld).
Sep 11 00:37:12 blog kernel: Out of Memory: Killed process 27105 (mysqld).
Sep 11 00:37:14 blog kernel: Out of Memory: Killed process 27106 (mysqld).
Sep 11 00:37:15 blog kernel: Out of Memory: Killed process 27107 (mysqld).
Sep 11 00:37:15 blog kernel: Out of Memory: Killed process 27114 (mysqld).
Sep 11 00:37:16 blog kernel: Out of Memory: Killed process 27115 (mysqld).
Sep 11 00:37:17 blog kernel: Out of Memory: Killed process 27123 (mysqld).
Sep 11 00:37:17 blog kernel: Out of Memory: Killed process 27125 (mysqld).
Sep 11 00:37:18 blog kernel: Out of Memory: Killed process 27133 (mysqld).
Sep 11 00:37:19 blog kernel: Out of Memory: Killed process 27137 (mysqld).

Solution:
先做一下调查:

# cat /etc/redhat-release
Red Hat Enterprise Linux ES release 2.1 (Panama)

# free -m
total used free shared buffers cached
Mem: 249 225 23 0 9 186
-/+ buffers/cache: 30 218
Swap: 511 39 472

# uname -a
Linux www.example.com 2.4.9-e.12 #1 Tue Feb 11 03:12:29 EST 2003 i686 unknown

# mysql --version
mysql Ver 12.22 Distrib 4.0.21, for pc-linux (i686)

# mysql --print-defaults
mysql would have been started with the following arguments:
--port=3306 --socket=/tmp/mysql.sock --no-auto-rehash

/etc/my.cnf 的主要设置
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
myisam_sort_buffer_size = 8M

参考 mysql 源代码中的 support-files 目录下的 my-small.cnf, 将以下值进行修改:

table_cache = 4
sort_buffer_size = 64K
net_buffer_length = 2K
thread_stack = 64K

另外,这个Server的内存出奇的小,所以添加内存也许是一个捷径。

(END)

发表评论

(如果您还为在此成功留言,也许是因为需要管理员逐一审核留言内容后放可看到您的评论。请稍后并感谢您的耐心等待。)

阅览更多文章请访问 首页过去的存档