mysql每天都重启动问题排查(mysqld_safe mysqld restarted)

环境:
OS:Centos 7
DB:mysql 5.7

 

1.测试环境一台机器每天都要重启一次

2024-03-31T20:08:10.130560Z mysqld_safe mysqld restarted
2024-03-31T20:08:10.183119Z 0 [Warning] Changed limits: max_open_files: 5000 (requested 25000)
2024-03-31T20:08:10.183338Z 0 [Warning] Changed limits: max_connections: 4190 (requested 5000)
2024-03-31T20:08:10.183349Z 0 [Warning] Changed limits: table_open_cache: 400 (requested 2000)

 

2.查看/etc/security/limits.conf

*      soft    nproc           65536
*      hard    nproc           65536
*      soft    nofile          65536
*      hard    nofile          65536

配置正常

 

3.查看自启动配置文件
我这里做了系统服务自启动的方式,在文件里写死了LimitNOFILE = 5000,问题应该是这里导致的

[root@localhost logfile]# vi /usr/lib/systemd/system/mysql.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql
ExecStart=/home/mysql57/bin/mysqld_safe --defaults-file=/home/mysql57/conf/my.cnf --user=mysql
##LimitNOFILE = 5000
#Restart=on-failure
#RestartPreventExitStatus=1
#PrivateTmp=false

将LimitNOFILE = 5000参数注释掉,然后重启mysql服务

 

posted @ 2024-04-01 15:32  slnngk  阅读(142)  评论(0编辑  收藏  举报