Understanding Logrotate & its issues


#1

Hi, I have a site that usually gave “Error establishing DB connection” error after 3-4 days. mysql does not start. The way I resolve it temporary is I changed logrotate value to 52 from 3 in /etc/logrotate.d/nginx

and restart it from command logrotate -f -v /etc/logrotate.d/nginx as suggested in https://easyengine.io/tutorials/linux/logrotate/

so it mysql start running and my site works fine

I need a permanent issue to resolve this problem I am new to easy Engine Nginx everything

Thanks in Advance


#2

@naqirizvi It can be because of low diskspace in your system. When you apply logrotate with smaller value, it will free up some space and your mysql service have started. If you face the issue again, have a look into free diskspace available using df -h and the error log /var/log/mysql.err for more details. It would help you to figure out the exact issue.


#3

Thanks for you reply, got by running df -h

Filesystem Size Used Avail Use% Mounted on udev 492M 12K 492M 1% /dev tmpfs 100M 360K 99M 1% /run /dev/xvda1 16G 9.4G 5.5G 64% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 497M 0 497M 0% /run/shm none 100M 0 100M 0% /run/user I ran nano /var/log/mysql.err it shows [ read 0 lines]

I just faced issues today and was getting “error establishing DB con” I restarted ee stack restart I have to run this command everyday to resolve issue


#5

@naqirizvi Bad code can cause mysql to stop unexpectedly. Can you try disabling all the plugins and reverting the theme to a default one and check whether the issue persists or not. If there is no entries in mysql.err log, have a look into /var/log/syslog.


#6