Mariadb   发布时间:2022-05-23  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了mariadb 在低配 VPS 上崩溃问题处理方案大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

引言

最近博客又抽风了,打开主页后提示 Error Establishing a Database Connection 。仔细想想,应该就是数据库服务器 mariadb 挂了;以前也遇到过类似的问题。经过分析日志,并结合网上的资料最终解决了问题。

日志

以下是 mariadb 服务器挂掉时的比较关键的日志信息,从下面的日志信息中,我们可以很容易地看出由于内存不足,从而导致数据库服务器启动时崩溃。

Ting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
160919 2:47:12 InnoDB: WaiTing for the BACkground threads to start
160919 2:47:13 Percona XTradB (
number 352718445
160919 2:47:13 [ERROR] MysqLd: Out of memory (Needed 128917504 bytes)
160919 2:47:13 [Note] Plugin 'FeedBACK' is Disabled.
160919 2:47:13 [Note] Server socket created on IP: '0.0.0.0'.
160919 2:47:13 [Note] Event scheduler: Loaded 0 events
160919 2:47:13 [Note] /usr/libexec/MysqLd: ready for connections.
Version: '5.5.47-MariaDB' socket: '/var/lib/MysqL/Mysql.sock' port: 3306 MariaDB Server
160919 02:47:35 MysqLd_safe number of processes running Now: 0
160919 02:47:35 MysqLd_safe MysqLd restarted
160919 2:47:35 [Note] /usr/libexec/MysqLd (MysqLd 5.5.47-MariaDB) starTing as process 28614 ...
160919 2:47:35 InnoDB: The InnoDB memory heap is Disabled
160919 2:47:35 InnoDB: Mutexes and rw_locks use GCC atomic builTins
160919 2:47:35 InnoDB: Compressed tables use zlib 1.2.7
160919 2:47:35 InnoDB: Using linux native AIO
160919 2:47:35 InnoDB: Initializing buffer pool,size = 128.0M
InnoDB: mmap(137756672 bytes) Failed; errno 12
160919 2:47:35 InnoDB: Completed initialization of buffer pool
160919 2:47:35 InnoDB: Fatal error: cAnnot allocate memory for the buffer pool
160919 2:47:35 [ERROR] Plugin 'InnoDB' init function returned error.
160919 2:47:35 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE Failed.
160919 2:47:35 [ERROR] MysqLd: Out of memory (Needed 128917504 bytes)
160919 2:47:35 [ERROR] MysqLd: Out of memory (Needed 96681984 bytes)
160919 2:47:35 [ERROR] MysqLd: Out of memory (Needed 72499200 bytes)
160919 2:47:35 [Note] Plugin 'FeedBACK' is Disabled.
160919 2:47:35 [ERROR] UnkNown/unsupported storage ENGIne: InnoDB
160919 2:47:35 [ERROR] AborTing

解决

在使用 free -m 查看内存信息时,发现 swap 分区大小为 0。难怪说数据库服务器无法启动呢,在内存不够用的情况下,又无法使用 swap 分区,自然崩溃了。由于 VPS 使用了 SSD,性能自然不错。下面我们给服务器系统 CentOS 7 添加 1024M 的 swap 分区,采用的方法是创建一个 swap 文件:

使用下面的命令创建 swapfile :

div class="codecode">

大佬总结

以上是大佬教程为你收集整理的mariadb 在低配 VPS 上崩溃问题处理方案全部内容,希望文章能够帮你解决mariadb 在低配 VPS 上崩溃问题处理方案所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: