LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-04-2017, 10:50 PM   #1
acabrales
LQ Newbie
 
Registered: Mar 2017
Posts: 2

Rep: Reputation: Disabled
Cool 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?
 
Old 03-04-2017, 11:03 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,870
Blog Entries: 27

Rep: Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662
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.
 
Old 03-04-2017, 11:10 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,342
Blog Entries: 11

Rep: Reputation: 3308Reputation: 3308Reputation: 3308Reputation: 3308Reputation: 3308Reputation: 3308Reputation: 3308Reputation: 3308Reputation: 3308Reputation: 3308Reputation: 3308
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?
 
1 members found this post helpful.
Old 03-06-2017, 06:56 PM   #4
acabrales
LQ Newbie
 
Registered: Mar 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
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.
 
Old 03-06-2017, 07:34 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179
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.
 
Old 03-06-2017, 10:31 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,870
Blog Entries: 27

Rep: Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662
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.

Last edited by frankbell; 03-06-2017 at 10:40 PM.
 
Old 03-06-2017, 11:10 PM   #7
iPad
Member
 
Registered: Oct 2016
Distribution: iPadLinux
Posts: 30
Blog Entries: 1

Rep: Reputation: 0
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to restart services, if they are down. sabarishks Linux - Server 2 10-30-2008 08:29 PM
Which Services Restart Network? cmnorton Linux - General 4 03-09-2008 09:35 AM
command to restart services djc Linux - Newbie 3 03-31-2004 03:04 PM
Why are tcp services falling over regularly? swellmaps Linux - Networking 0 10-28-2003 06:40 AM
How do I restart services in Linux rytskyo Linux - Newbie 3 05-06-2002 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration