<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://kb.linux-vs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Quinn</id>
		<title>LVSKB - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://kb.linux-vs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Quinn"/>
		<link rel="alternate" type="text/html" href="http://kb.linux-vs.org/wiki/Special:Contributions/Quinn"/>
		<updated>2026-05-02T09:51:19Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://kb.linux-vs.org/wiki?title=SorryServer&amp;diff=2697</id>
		<title>SorryServer</title>
		<link rel="alternate" type="text/html" href="http://kb.linux-vs.org/wiki?title=SorryServer&amp;diff=2697"/>
				<updated>2006-05-23T14:25:38Z</updated>
		
		<summary type="html">&lt;p&gt;Quinn: /* Setting up a Sorry-Server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setting up a Sorry-Server ==&lt;br /&gt;
&lt;br /&gt;
Sometime all of your real-servers might be down or overloaded. This can be due to a mantainace interval,&lt;br /&gt;
hardware failure, badly written dynamic web-content, broken databases or script kiddies bringing your site down.&lt;br /&gt;
In such a situation it is much more polite to tell your customers that you are sorry but your site currently&lt;br /&gt;
is down, rather than just being unavailable.&lt;br /&gt;
&lt;br /&gt;
To set up such a webserver you normally would serve only some static content telling your customers that&lt;br /&gt;
you are sorry, but your web-services currently are not available. However the requests your customers send,&lt;br /&gt;
are regular URLs which are not resolvable by your Sorry-Server, and therefore would be answered with an&lt;br /&gt;
Error-Code: '''404 - Not Found'''. This Error-Code can be very annoying, if at the moment of the outage a&lt;br /&gt;
robot (such as Googlebot) is indexing your webpages. In such a situation most of your webpages&lt;br /&gt;
will fall out of the Google-index and your web-site might have to wait for up to a week to return back to&lt;br /&gt;
the Google-index, depending on the number visits of Googlebot per month.&lt;br /&gt;
&lt;br /&gt;
== Using TUX as Sorry-Server ==&lt;br /&gt;
[http://www.redhat.com/docs/manuals/tux/TUX-2.2-Manual/ TUX] is a tiny webserver which runs inside the Linux&lt;br /&gt;
kernel and is therefore predestined as a Sorry-Server. If your Loadbalancer is able to pass your web-traffic to&lt;br /&gt;
a number of real-servers, TUX running on the Loadbalancer is able to handle all that traffic by itself.&lt;br /&gt;
&lt;br /&gt;
The only precaution using TUX is not to send a Status '''200 - Ok''' neither an Error-Code '''404 - Not Found'''&lt;br /&gt;
as as Sorry-Page. The best fitting Error-Code to send in such a situation is '''502 - Server Overloaded'''.&lt;br /&gt;
&lt;br /&gt;
However this is not the default behaviour, nor can TUX be configured to do so. You must apply a tiny patch onto&lt;br /&gt;
the TUX-kernel-code, recompile that kernel-module and reinstall it onto your Loadbalancer.&lt;br /&gt;
&lt;br /&gt;
Patch for Linux-kernel-2.4:&lt;br /&gt;
 diff -u kernel-2.4.21/linux-2.4.21/net/tux/proto_http.c linux-2.4.21-tux502/net/tux/proto_http.c&lt;br /&gt;
 --- linux-2.4.21/net/tux/proto_http.c     2005-03-07 15:09:45.000000000 +0100&lt;br /&gt;
 +++ linux-2.4.21-tux502/net/tux/proto_http.c    2005-03-07 15:08:13.000000000 +0100&lt;br /&gt;
 @@ -1172,7 +1172,7 @@&lt;br /&gt;
         &amp;quot;&amp;lt;HTML&amp;gt; Forbidden &amp;lt;/HTML&amp;gt;&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
  static const char not_found[] =&lt;br /&gt;
 -       &amp;quot;HTTP/1.1 404 Not Found\r\n&amp;quot;&lt;br /&gt;
 +       &amp;quot;HTTP/1.1 502 Service temporarily down\r\n&amp;quot;&lt;br /&gt;
         &amp;quot;Connection: Keep-Alive\r\n&amp;quot; \&lt;br /&gt;
         &amp;quot;Content-Length: 29\r\n\r\n&amp;quot;&lt;br /&gt;
         &amp;quot;&amp;lt;HTML&amp;gt; Page Not Found &amp;lt;/HTML&amp;gt;&amp;quot;;&lt;br /&gt;
 @@ -1838,7 +1838,7 @@&lt;br /&gt;
                 &amp;quot;HTTP/1.1 206 Partial Content&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  #define HEADER_PART1C \&lt;br /&gt;
 -               &amp;quot;HTTP/1.1 404 Page Not Found\r\n&amp;quot; \&lt;br /&gt;
 +               &amp;quot;HTTP/1.1 502 Service temporarily down\r\n&amp;quot; \&lt;br /&gt;
                 &amp;quot;Content-Type: &amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  #define HEADER_PART1D \&lt;br /&gt;
&lt;br /&gt;
Patch for Linux-kernel-2.6:&lt;br /&gt;
 diff -ur linux-2.6.9/net/tux/proto_http.c linux-2.6.9-tux502/net/tux/proto_http.c&lt;br /&gt;
 --- linux-2.6.9/net/tux/proto_http.c    2005-03-15 12:08:56.660827776 +0100&lt;br /&gt;
 +++ linux-2.6.9-tux502/net/tux/proto_http.c     2005-03-15 13:13:49.437035840 +0100&lt;br /&gt;
 @@ -1174,7 +1174,7 @@&lt;br /&gt;
         &amp;quot;&amp;lt;HTML&amp;gt; Forbidden &amp;lt;/HTML&amp;gt;&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
  static const char not_found[] =&lt;br /&gt;
 -       &amp;quot;HTTP/1.1 404 Not Found\r\n&amp;quot;&lt;br /&gt;
 +       &amp;quot;HTTP/1.1 502 Service temporarily down\r\n&amp;quot;&lt;br /&gt;
         &amp;quot;Connection: Keep-Alive\r\n&amp;quot; \&lt;br /&gt;
         &amp;quot;Content-Length: 29\r\n\r\n&amp;quot;&lt;br /&gt;
         &amp;quot;&amp;lt;HTML&amp;gt; Page Not Found &amp;lt;/HTML&amp;gt;&amp;quot;;&lt;br /&gt;
 @@ -1840,7 +1840,7 @@&lt;br /&gt;
                 &amp;quot;HTTP/1.1 206 Partial Content&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  #define HEADER_PART1C \&lt;br /&gt;
 -               &amp;quot;HTTP/1.1 404 Page Not Found\r\n&amp;quot; \&lt;br /&gt;
 +               &amp;quot;HTTP/1.1 502 Service temporarily down\r\n&amp;quot; \&lt;br /&gt;
                 &amp;quot;Content-Type: &amp;quot;&lt;br /&gt;
 &lt;br /&gt;
  #define HEADER_PART1D \&lt;br /&gt;
&lt;br /&gt;
== Running the Sorry-Server ==&lt;br /&gt;
First start the TUX kernel-thread, by invoking &lt;br /&gt;
 /etc/init.d/tux start&lt;br /&gt;
The Sorry-Server can run all the time, even if you don't need it.&lt;br /&gt;
&lt;br /&gt;
In case all of your real-servers are down, you must reroute the traffic onto the Sorry-Server. First flush the Real-Server&lt;br /&gt;
Tables of your [[IPVS]] invoking &lt;br /&gt;
 ipvs -d -t ''service-address'' -r ''server-address''&lt;br /&gt;
for each of your real-servers. Next add a route the web-traffic onto the Sorry-Server, this normally is done by invoking &lt;br /&gt;
 ipvs -a -t ''service-address'' -r 127.0.0.1:80&lt;br /&gt;
once. All web-traffic now is redirected onto the Sorry-Server.&lt;br /&gt;
&lt;br /&gt;
Depending on where the TUX-configuration says to have its '''DOCUMENTROOT''', go to that directory and edit the file '''404.html''' adding some text such as ''Momentary system interruption''. You may also add stylesheet- and image-files to the Sorry-Server DOCUMENTROOT, you should however delete any '''index.html''' file since this would be served by default and with a HTTP-Status '''200 - OK'''. This is certainly not your intention.&lt;br /&gt;
&lt;br /&gt;
== Using keepalived ==&lt;br /&gt;
The [http://www.keepalived.org/ keepalived] is a program to check real-servers and manage the [[IPVS]]-Tables accordingly. Keepalived can be configured to automatically reroute all the web-traffic onto a Sorry-Server in case all real-servers are down. Simply add this line to each '''virtual_server''' section in the keepalived's configuration file:&lt;br /&gt;
 virtual_server ''service_address'' {&lt;br /&gt;
         ''...snip...''&lt;br /&gt;
         sorry_server 127.0.0.1 80&lt;br /&gt;
         ''...snip...''&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== CREDITS ==&lt;br /&gt;
TUX is a Linux kernel-project mantained by [http://www.redhat.com RedHat].&lt;br /&gt;
&lt;br /&gt;
This patch is maintained by Jacob Rief.&lt;/div&gt;</summary>
		<author><name>Quinn</name></author>	</entry>

	</feed>