innodb_buffer_pool_size参数,顾名思义,应该是负责innodb缓存池大小的吧。
自从买了这个900块3年的腾讯云之后(配置1核1G1M带宽),mysql(mariadb)经常挂,重启又好了。今天看了日志,内容如下:
190307 02:47:50 mysqld_safe Number of processes running now: 0
190307 02:47:50 mysqld_safe mysqld restarted
190307 2:47:52 [Note] /usr/libexec/mysqld (mysqld 5.5.60-MariaDB) starting as process 25683 ...
190307 2:47:52 InnoDB: The InnoDB memory heap is disabled
190307 2:47:52 InnoDB: Mutexes and rw_locks use GCC atomic builtins
190307 2:47:52 InnoDB: Compressed tables use zlib 1.2.7
190307 2:47:52 InnoDB: Using Linux native AIO
190307 2:47:52 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
190307 2:47:52 InnoDB: Completed initialization of buffer pool
190307 2:47:52 InnoDB: Fatal error: cannot allocate memory for the buffer pool
190307 2:47:52 [ERROR] Plugin 'InnoDB' init function returned error.
190307 2:47:52 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
190307 2:47:52 [Note] Plugin 'FEEDBACK' is disabled.
190307 2:47:52 [ERROR] Unknown/unsupported storage engine: InnoDB
190307 2:47:52 [ERROR] Aborting
190307 2:47:52 [Note] /usr/libexec/mysqld: Shutdown complete
190307 02:47:52 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
看不太懂,不过里面有个致命错误提示的是无法给缓存分配内存,是不是这里的问题呢?
百度吧,然后就是innodb_buffer_pool_size这个参数来控制内存的大小。通过show global variables like 'innodb_buffer_pool_size'来查看其值,是128M,是不是有点大啊,看了看系统内存就几十M,估计有可能是这里的问题,改成50M试试吧。
在my.cnf里设置如下:
innodb_buffer_pool_size = 50M
好像不设置默认就是128M。
重启就生效了。
my.cnf里有很多分组,我是写在了[mysqld-5.5]分组下,因为我mysql的版本是5.5。
刚搞完,具体是不是这个参数引起的mysql挂,观察几天看看吧。
有关PHP系统、Discuz或网站等各种问题,可以联系QQ1069971363寻求付费支持
|