宝塔面板MySql进程守护脚本

文章目录

前段时间奶爸把一台VPS环境从LNMP换到了宝塔面板,结果经常MySQL数据库莫名其妙的自动停止,看日志也没看出来是什么问题,所以就只能来一招最简单的数据库进程守护了。

宝塔面板添加MySQL进程守护脚本方法

宝塔面板后台,点击计划任务,然后添加一个Shell脚本。名字自选,执行周期按分钟执行,奶爸这里是设置的十分钟,脚本内容如下:

pgrep -x mysqld &> /dev/null
if [ $? -ne 0 ];then
        bash /www/server/panel/script/rememory.sh   
        /etc/init.d/mysqld start      
fi

宝塔面板数据库守护

另外在MySQL的性能优化里面,设置了一下,然后保存了发现并没什么卵用,MySQL依然停止运行,代码如下,空了再来具体研究问题所在了。

190513 14:39:11 [Note] /www/server/mysql/bin/mysqld: Normal shutdown

190513 14:39:11 [Note] Event Scheduler: Purging the queue. 0 events
190513 14:39:11  InnoDB: Starting shutdown...
190513 14:39:12  InnoDB: Shutdown completed; log sequence number 618693401
190513 14:39:12 [Note] /www/server/mysql/bin/mysqld: Shutdown complete

190513 14:39:13 [Note] Plugin 'FEDERATED' is disabled.
190513 14:39:13 InnoDB: The InnoDB memory heap is disabled
190513 14:39:13 InnoDB: Mutexes and rw_locks use GCC atomic builtins
190513 14:39:13 InnoDB: Compressed tables use zlib 1.2.7
190513 14:39:13 InnoDB: Using Linux native AIO
190513 14:39:13 InnoDB: Initializing buffer pool, size = 256.0M
190513 14:39:13 InnoDB: Completed initialization of buffer pool
190513 14:39:13 InnoDB: highest supported file format is Barracuda.
190513 14:39:14  InnoDB: Waiting for the background threads to start
190513 14:39:15 InnoDB: 5.5.57 started; log sequence number 618693401
190513 14:39:15 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
190513 14:39:15 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
190513 14:39:15 [Note] Server socket created on IP: '0.0.0.0'.
190513 14:39:15 [Warning] 'user' entry 'x@%' has both a password and an authentication plugin specified. The password will be ignored.
190513 14:39:15 [Note] Event Scheduler: Loaded 0 events
190513 14:39:15 [Note] /www/server/mysql/bin/mysqld: ready for connections.
Version: '5.5.57-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
190513 14:39:21 [Warning] IP address '2' has been resolved to the host name '2.vultr.com', which resembles IPv4-address itself.
190513 14:39:43 [Warning] IP address '9' has been resolved to the host name '9.vultr.com', which resembles IPv4-address itself.
190513 14:39:48 [Warning] IP address '8' has been resolved to the host name '8.vultr.com', which resembles IPv4-address itself.
190513 14:40:12 [Warning] IP address '9' has been resolved to the host name '9.vultr.com', which resembles IPv4-address itself.

2019年05月14日更新:依然死,调整了下swap大小再观察下。然后还重启了一次服务器。开机后内存使用600+,还空200+

版权申明
如未注明,均为奶爸笔记原创,码字不易,转载请注明出处及原文链接!
本文标题:《宝塔面板MySql进程守护脚本》
本文链接地址:https://blog.naibabiji.com/archives/806
  • QQ群二维码
  • 赞赏二维码
  • 微信二维码

你可能感兴趣

宝塔面板MySql进程守护脚本》有23个想法

    1. ᕕ(ᐛ)ᕗ变身!ᕕ(ᐛ)ᕗ变身! 文章作者

      不知道,都是宝塔默认的安装和配置,还没去研究,我打算的是如果进程守护还报错就换回lnmp了。

      回复
      1. ᕕ(ᐛ)ᕗ变身!秦大叔

        感觉并不是面板占内存的问题,我重启PHP后,内存只占百分之二十几,然后就开始慢慢上升,两三天功夫就能升到百分之八十几,如果不管,在之后的几天必定会出现无法连接数据库的错误。

        回复
        1. ᕕ(ᐛ)ᕗ变身!ᕕ(ᐛ)ᕗ变身! 文章作者

          和我的一样,重启后内存使用300M左右,然后慢慢就700+,到了800+就会挂。我准备的是到时候再挂就改回LNMP去,稳得一B。

          回复
          1. ᕕ(ᐛ)ᕗ变身!ᕕ(ᐛ)ᕗ变身! 文章作者

            LNMP用习惯了觉得比宝塔还简单,只不过需要自己电脑随时有SSH和SFTP软件。

        1. ᕕ(ᐛ)ᕗ变身!ᕕ(ᐛ)ᕗ变身! 文章作者

          用lnmp的多数是老站长,我觉得比宝塔简单呢,闭着眼睛我都知道代码怎么输。

          回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注