Hi

I have a micro instance of Media Wiki running. Always worked perfectly till now when suddenly it reports as follows:

 

Sorry! This site is experiencing technical difficulties.

Try waiting a few minutes and reloading.

(Can't contact the database server: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) (localhost))

url is http://crackpotscience.tklapp.com

 

Please assist/advise.

 

Thanks,

Neil Parker

Forum: 
Jeremy Davis's picture

My first guess is that MySQL has crashed (usually due to running out of RAM). Check to see if MySQL is running:
service mysql status
Unless it is "active (running)" then that's the issue. Restart it with
service mysql start
Then you'll need to investigate why it's broken. It may be that your server has just reached the point where a micro does not provide enough resources over the longer term. If that's the case rebooting the server may allow it to run for a while before it crashes again.

You could read up on adjusting the OOM killer behaviour (so it kills something other than MySQL when it runs out of RAM; perhaps an Apache fork process)?

Or you could just upgrade to a larger server.

Many thanks for your response to above server problem.

What I have tried is logging in to the server and typing df -v on the command line. All the disk space is used up so I guess that is probably the main problem - perhaps not RAM because then the problem would have manifested immediately rather than after several months usage.

The SQL server is not active at all - I would guess it crashes when unable to open further files. Could you perhaps advise on what files I can safely delete. I would presume the startpoint is *.gz in /var/log ? What other 'housekeeping' measures are there on a Media Wiki server ? Finally is it safe to  reboot a micro-instance without any backup in place ?

Jeremy Davis's picture

It sounds like I may have been jumping to conclusions... Although FWIW too little RAM won't necessarily cause an instant crash. Even on a system with very low RAM, often there is plenty enough RAM initially, but over time processes eat it up and if they don't free it when they are finished then eventually you can run out of RAM (causing a crash). Apache is notorious for chewing up RAM and not releasing it properly, especially when paired with poorly coded PHP (e.g. flaky WordPress plugins).

Anyway, a good place to start cleaning up is an apt clean (deletes downloaded update package cache) and autoremove (uninstalls packages that are no longer required):

apt-get clean
apt-get autoremove
Then check how much space is left. Hopefully that has cleaned up a bit. If you want to investigate where all your space has gone try installing ncdu:
apt-get install ncdu
Then run it like this:
ncdu /
It will take a while to scan through your whole drive, then it will display the results ordered in size of directory. Don't touch anything in /usr some of the files in /var might be ok to delete, but unless you know what it is; double check first (removal of some files may break things). /root is the root account home directory so generally most things (except for files or directories that start with a ".") there can be safely removed (assuming you don't want/need them).
Jairawat's picture

that's a good point jermey davis. It will clean up RAM a little bit but it will help to investigate the RAM usage by other processes.

 

Add new comment