LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Restart services regularly? (https://www.linuxquestions.org/questions/linux-newbie-8/restart-services-regularly-4175601096/)

acabrales 03-04-2017 09:50 PM

Restart services regularly?
 
Hi guys,

This is the first time I post, so I have a Debian server that holds a web application. This web application produces a lot of MySQL processes, in order to access the website I need to restart MySQL. Questions is, How bad is it to restart MySQL service or any other service in particular, is it bad practice to regularly do this?

frankbell 03-04-2017 10:03 PM

Which version of Debian are you using, pre-SystemD (7 or earlier) or post-SystemD (8)? The service management differs depending on the init system. Please note, the more information you provide, the easier it is for us to help you. You might want to read this.

Stopping and restarting the service may pose a temporary inconvenience to any users who may happen to be connected when you do it, but, otherwise, it should be harmless.

It seems to me the underlying issue is, why does MySQL cause your system to have such issues? If you have to continually restart services, there seems to some type of resource or resource-utilization issue here.

astrogeek 03-04-2017 10:10 PM

Welcome to LQ!

In general, if your web server periodically becomes unavailable due to too many open MySQL processes, it indicates a problem which must be solved. Restarting the MySQL server is not a fix, it only allows you to temporarily ignore the real problem.

To get help with the actual problem you will need to provide more information including some description of the applications that are running, how heavy your web traffic is, OS version and whether the server is hosted or physical, etc.

Have you looked at the running processes and logs to see what queries are keeping them open, or what processes fail to terminate properly? If so, what did they say?

acabrales 03-06-2017 05:56 PM

Hello Guys,

Thanks for the quick responce, this is a Debian 8.7, I use this server as an IDS. I use suricata in this server and I get a lot of traffic since I collect syslog, OSSEC logs and NIDs traffic from a spanport. If I htop most of the running processes are for mysql. I will analyze the logs to see anything unusual thanks.

sundialsvcs 03-06-2017 06:34 PM

I confess to be totally confused by what you actually mean when you say that "running processes are for MySQL."

There would of course be only one "MySQL server" process.

Various MySQL configuration parameters allow you to control how many queries will be "under way" at any particular time, obliging all other requests to wait their turn. It sounds to me like you need to avail yourself right-away of some of these adjustments!

"In any case, 'no.'" Services might well run for many weeks or months at a time.

frankbell 03-06-2017 09:31 PM

In my experience, MySQL can spawn multiple processes.

I have it running locally as part of my project get my website to run on localhost using native Slackware packages, because I want to. I'm not really doing anything with it right now other than running it at startup (I've got to resolve some issues with PHP and Apache), but I still get this:

Code:

bash-4.4$ ps -A | grep sql
 1556 ?        00:00:00 mysqld_safe
 1646 ?        00:04:11 mysqld
 2038 ?        00:04:24 mysqld

mysqld_safe is the server process itself. I'm not knowledgeable to know exactly what spawned the other two mysqld process, but I assume OP is referring to something along the above lines.

iPad 03-06-2017 10:10 PM

The LQgurus are very correct that, basically/generally, Unix things don't need restarting UNLESS a configuration issue!
Web searches seem to reveal specific ways to collect more info; try maybe: mysql high cpu usage
Once you uncover enough clues, you will get the solution! Welcome to LQ!


All times are GMT -5. The time now is 10:28 PM.