您的位置:首页 > 数据库 > MySQL

[MySQL FAQ]系列 -- 64位系统下也报内存分配不能超过2G?

2008-08-29 14:29 267 查看
作/译者:叶金荣(Email:

),来源:http://imysql.cn,转载请注明作/译者和出处,并且不能用于商业用途,违者必究。
明明是64位系统下,有16G内存,启动mysqld时指定 innodb_buffer_pool_size 为12G,却报一下错误:
080829 14:15:14  mysqld started
InnoDB: HugeTLB: Warning: Failed to allocate 12884918272 bytes. errno 22
InnoDB HugeTLB: Warning: Using conventional memory pool
080829 14:15:14  InnoDB: Error: cannot allocate 12884918272 bytes of
InnoDB: memory with malloc! Total allocated memory
InnoDB: by InnoDB 44607312 bytes. Operating system errno: 12
InnoDB: Check if you should increase the swap file or
InnoDB: ulimits of your operating system.
InnoDB: On FreeBSD check you have compiled the OS with
InnoDB: a big enough maximum process size.
InnoDB: Note that in most 32-bit computers the process
InnoDB: memory space is limited to 2 GB or 4 GB.
InnoDB: We keep retrying the allocation for 60 seconds...
InnoDB: Fatal error: cannot allocate the memory for the buffer pool
Warning: Failed to allocate 29360128 bytes from HugeTLB memory. errno 12
Warning: Using conventional memory pool
080829 14:16:14 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.0.45-log'  socket: '/home/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

是不是很奇怪呢?
根据错误提示的内容,google一下,发现是内核限制的缘故:
[root@yejr mysql]# cat /proc/sys/vm/nr_hugepages
6000

修改一下内核限制:
[root@yejr mysql]# echo 0 > /proc/sys/vm/nr_hugepages

然后重启mysql,一切正常了。
另外,还需要关注一下配置文件 /etc/security/limits.conf 里的内容。
本文出自 “MySQL中文网”博客 http://www.imysql.cn/本文出自 “爱MySQL” 博客,转载请与作者联系!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: