How-to: Maintain Web Server Uptime
Posted by Jon Lee in How-to, Linux, Web Development, tags: Apache, How-to, SIM, tips
Last Sunday at around 9am, all of my sites hosted on mediatemple’s dedicated server were unresponsive. Because I was out for most of the day, I was not aware of this until I had returned home later in the evening. As a result, all of my sites were down for nearly 6 hours.
The Problem
My first thought was that mediatemple was experiencing an outage but that was not the case as I could still access FTP and SSH. My next thought was that perhaps the web server, Apache, had crashed and bingo! A simple check confirmed that Apache had indeed stopped.
Restarting Apache
Starting up Apache again may be different depending on the system configuration but essentially it is just one line of code:
/etc/init.d/httpd start
System Integrity Monitor
To prevent something like this from happening again, I installed a piece of free software I found called System Integrity Monitor (SIM) by R-fx Networks. What it does is at a set time interval, it will check to make sure certain things are running and if not, it will restart them. It has a large list of features (from the website):
- Service monitoring of HTTP, FTP, DNS, SSH, MYSQL & more
- Event tracking and alert system
- Auto restart ability for downed services
- Checks against network sockets & process list to ensure services are online
- Advanced HTTP service monitoring, to prevent commonly encountered issues
- System load monitor with customizable warnings & actions
- Ability to auto restart system with definable critical load level
- Priority change configurable for services, at warning or critical load level
- Informative command line status display
Auto-restarting down services was exactly what I was looking for. The rest is just icing on the cake. SIM is highly configurable via a simple configuration file and is able to monitor system load in case a script or program gets out of hand.
SIM Installation
Installation is also relatively straightforward, it is the configuration that may take a while. Here is an outline of the steps I took:
- Download the latest version from the official site.
- Extract the installation files somewhere.
tar -xzvf sim-current.tar.gz
- Then navigate to the folder that was extracted and run the setup file.
./setup -i
- The guided installation is pretty straightforward, defaults should be fine for most people (just keep on pressing Enter).
- Once installed, SIM will automatically run the auto-configuration program. Here you can specifiy which services SIM should be monitoring and what to do in different circumstances. Again, defaults should be fine (as long as you are running that particular service). If you mess up the auto-configuration, you can run it again later through the autoconf file.
- Afterwards, you should check to make sure a cronjob was properly set to run SIM at a specified time interval (i.e. every 10 minutes).
That’s pretty much it, setup took less than 5 minutes! For more details be sure to read the documentation.
An Easier Way
Now normally, with regular shared hosting plans this should be a concern for the web host, and not the website owner. However, since I am on a dedicated plan, I get the benefits of my own dedicated server along with all the responsibilities that come with it. All mediatemple is responsible for is to make sure that the system is up and running while I am responsible for making sure all the software I had installed on it is running properly.
For this fact alone, dedicated hosting may not be for everybody. For managed shared hosting, check out my web hosting recommendations.
Popularity: 10% [?]
Entries (RSS)