<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		
		<title>foobar.lamp-solutions.de Serveradministration</title>
		<link>http://foobar.lamp-solutions.de/</link>
		<description>HowTos zur Serveradministration</description>
		<language>de</language>
		<image>
			<title>foobar.lamp-solutions.de Serveradministration</title>
			<url>http://foobar.lamp-solutions.de/fileadmin/tt_news_article.gif</url>
			<link>http://foobar.lamp-solutions.de/</link>
			<description>HowTos zur Serveradministration</description>
		</image>
		<generator>TYPO3 - get.content.right</generator>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		
		
		
		<lastBuildDate>Wed, 28 Dec 2011 15:10:00 +0100</lastBuildDate>
		
		
		<item>
			<title>Mit Varnish-Proxy eigene Seiten günstig über mehrere Server verteilen </title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/mit-varnish-proxy-eigene-seiten-guenstig-ueber-mehrere-server-verteilen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/mit-varnish-proxy-eigene-seiten-guenstig-ueber-mehrere-server-verteilen.html</guid>
			<description>Statt als Load Balancer die Anfragen an mehre Webserver durchzureichen, wollen wir ein Setup...</description>
			<content:encoded><![CDATA[Für Webseiten, die eine hohe Cache-Hitrate haben, also die meisten Anfragen direkt vom Caching-Proxy beantwortet werden, hat ein solches Setup mehrere Vorteile:<br /><br />
<ol><li>Die verfügbare Bandbreite erhöht sich linear mit der Anzahl der Caching-Server</li><li>Da der Varnish-Cache sehr geringe Hardwareanforderungen hat, können die Satellitensysteme auf kleine und preiswerte virtuelle Maschinen aufbauen</li><li>Die Satellitensysteme können regional verteilt werden, damit zum Beispiel eine englischsprachige Seite von einem Server in den USA ausgeliefert wird, um kurze Latenzen zu bekommen</li><li>Die Pflege der Inhalte findet auf einem einzelnen Server statt und ist damit besonders einfach</li><li>Für Seitennetzwerke kann es bei der Suchmaschinenoptimierung nützlich sein, viele IP-Adressen an unterschiedlichen Standorten und in unterschiedlichen Netzen zu besitzen</li></ol>
<br /><br />Auf dem zentralen Server kann eine Normale Webanwendung laufen. Es bieten sich CMS-Systeme an, die in einer Installation mehrere Webseiten verwalten können, zum Beispiel <link 159 - internal-link "Öffnet internen Link im aktuellen Fenster">TYPO3</link>, oder ein <link http://foobar.lamp-solutions.de/howtos/wordpress/plugins/plugins-einzelansicht/archive/2011/may/artikel/mehrere-blogs-mit-einer-wordpress-installation-betreiben.html>Multiblog mit Wordpress</link>.<br /><br /><br />Auf den Satellitensystemen wird nur ein Varnish-Cache benötigt. Eventuell kann es noch nützlich sein, darauf eine Statistiksoftware wie AWStats zu installieren, um die <link http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/zugriffsstatistiken-auf-varnish-fuer-einzelne-vhosts-mit-awstats-anlegen.html>Logfiles des Varnish-Caches</link> auszuwerten.<br /><br /><br />Die Konfiguration des Varnish auf den Satellitensystemen kann größtenteils der Standard-Installation entsprechen. Wichtig ist, dass bei einem Ausfall, oder bei Wartungsarbeiten auf dem zentralen System nicht auf allen Satelliten Fehlermeldungen ausgeliefert werden. Dazu verändern wir die Verweildauer der Datensätze im Cache für den Fall, dass der Webserver mal nicht erreichbar ist.<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend default <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> .host = <span style="color: #ff0000;">&quot;&lt;IP-des-Webservers&gt;&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> .port = <span style="color: #ff0000;">&quot;80&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .probe = <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .url = <span style="color: #ff0000;">&quot;/index.html&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .interval = 5s; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .timeout = 10s; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .window = <span style="color: #000000;">5</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .threshold = <span style="color: #000000;">3</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_recv <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">set</span> req.backend = default; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #666666; font-style: italic;">#Falls das Backen nicht erreichbar, liefern wir fuer eine Stunde alten Inhalt aus </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.backend.healthy<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">else</span><span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000000; font-weight: bold;">set</span> req.grace = 1h; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">...</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li></ol></pre></div></div><br /><br />Selbst über eine kleine virtuelle Maschine für 10 Euro/Monat, die über einen CPU-Kern und 512 MB RAM verfügt, konnten wir mehrere tausend Anfragen pro Minute an einen WordPress-Blog schieben, ohne dass die Last auf dem Satellitensystem oder dem zentralen Webserver nennenswert gestiegen wäre.]]></content:encoded>
			<category>Verschiedenes</category>
			
			
			<pubDate>Thu, 20 Oct 2011 12:22:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Firefox Sync Server</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/firefox-sync-server.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/firefox-sync-server.html</guid>
			<description>Firefox Sync Server unter Ubuntu installieren</description>
			<content:encoded><![CDATA[<br />In diesem Artikel geht es um die Installation des Synchronisierungsserver Firefox Sync mit Hilfe des HTTP Servers Apache2.<br />Firefox Sync ermöglicht einem Firefox Browser Benutzer unter verschiedenen Geräten die gleichen Lesezeichen, den Browserverlauf sowie die gespeicherten Loginnamen und vieles mehr zu nutzen.<br /><br />Zwar bietet Firefox Sync als Dienst an, wer aber lieber seine Daten nicht in fremde Hände geben will, kann auch die Serversoftware auf seinen eigenen Server installieren.<br /><br /><span style="font-weight: bold; ">1) Installation unter Ubuntu</span><br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> python-dev mercurial sqlite3 python-virtualenv libapache2-mod-wsgi</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">mv</span> server-full weave</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">cd</span> weave</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">make</span> build</div></li></ol></pre></div></div>
Das Kommando <span style="font-weight: bold; ">make build</span> wird einige Zeit dauern, da Weave seine eigene Python Umgebung erstellt.<br /><br /><br /><span style="font-weight: bold; ">2) Konfiguration</span><br /><br />Zwar bringt Firefox Sync seinen eigenen HTTP Server mit, dieser ist aber nicht für eine hohe Last konzipiert und somit nur zum Testen gedacht.<br />Aus diesem Grund benutzen wir den Apache2 als Server, welcher mit dem Packet libapache2-mod-wsgi erlernt Python Code auszuführen.<br /><br /><span style="font-weight: bold; ">2.1) Konfiguration Firefox Sync</span>
<br />In diesem Artikel nutzen wir die Datenbankengine SQLITE.<br /><br />Als erstes erstellen wir ein Verzeichniss für die Datenbank.<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span></div></li></ol></pre></div></div><br /><br />Und geben diesem Verzeichniss Rechte damit www-data schreiben kann.<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">770</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>data</div></li></ol></pre></div></div><br /><br />Zusätzlich geben wir www-data Rechte für das folgende Verzeichniss<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chown</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>deps<span style="color: #000000; font-weight: bold;">/</span>server-reg<span style="color: #000000; font-weight: bold;">/</span>syncreg<span style="color: #000000; font-weight: bold;">/</span>templates</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">770</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>deps<span style="color: #000000; font-weight: bold;">/</span>server-reg<span style="color: #000000; font-weight: bold;">/</span>syncreg<span style="color: #000000; font-weight: bold;">/</span>templates</div></li></ol></pre></div></div><br /><br /><br /><br />Wir öffnen die Datei /opt/weave/etc/sync.conf und ändern Folgende Dinge ab:<br /><br />Unter dem Punkt<span style="font-weight: bold; "> [storage]</span> und<span style="font-weight: bold; "> [auth]</span>:<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sqluri = sqlite:<span style="color: #000000; font-weight: bold;">////</span>tmp<span style="color: #000000; font-weight: bold;">/</span>test.db</div></li></ol></pre></div></div><br />zu<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sqluri = sqlite:<span style="color: #000000; font-weight: bold;">////</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>ffsync.db</div></li></ol></pre></div></div><br /><br />Außerdem muss noch die Fallbacknode unter [auth] gesetzt werden:<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">fallback_node = htlp:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">5000</span><span style="color: #000000; font-weight: bold;">/</span></div></li></ol></pre></div></div><br />zu<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">fallback_node = htlp:<span style="color: #000000; font-weight: bold;">//</span>weave.meinserver.lan</div></li></ol></pre></div></div><br /><br />Falls ein SMTP Server zur Verfügung steht konfigurieren wir diesen auch.<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>smtp<span style="color: #7a0874; font-weight: bold;">&#93;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">host = localhost</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">port = <span style="color: #000000;">25</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sender = admin<span style="color: #000000; font-weight: bold;">@</span>weave.meinserver.lan</div></li></ol></pre></div></div><br /><span style="font-weight: bold; ">2.2) Konfiguration Apache2</span><br /><br />Um den Apache2 zu konfigurieren, müssen wir einen neuen VHost erstellen.<br />Wie ein VHost aussehen kann zeigt folgendes Beispiel:<br /><br /><br />Datei: <br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-available<span style="color: #000000; font-weight: bold;">/</span>weave.meinserver.lan</div></li></ol></pre></div></div><br /><br />Inhalt:<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  ServerName weave.meinserver.lan</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  DocumentRoot <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  WSGIProcessGroup <span style="color: #c20cb9; font-weight: bold;">sync</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  WSGIDaemonProcess <span style="color: #c20cb9; font-weight: bold;">sync</span> <span style="color: #007800;">user</span>=www-data <span style="color: #007800;">group</span>=www-data <span style="color: #007800;">processes</span>=<span style="color: #000000;">2</span> <span style="color: #007800;">threads</span>=<span style="color: #000000;">25</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  WSGIPassAuthorization On</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  WSGIScriptAlias <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>sync.wsgi</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  CustomLog <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>weave.meinserver.lan-access.log combined</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  ErrorLog  <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>weave.meinserver.lan-error.log</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;</span>Directory <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  Order deny,allow</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  Allow from all</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;/</span>Directory<span style="color: #000000; font-weight: bold;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li></ol></pre></div></div><br /><br /><span style="font-weight: bold; ">3) In Betrieb nehmen</span><br /><br />Sobald wir den Apache neu starten, sollte nun der FireFox Sync Server unter weave.meinserver.lan erreichbar sein.<br /><br /><span style="font-weight: bold; ">4) Fehlersuche</span><br /><br />Falls es Probleme gibt, sollte man in den Dateien /var/log/apache2/weave.meinserver.lan-error.log sowie /var/log/apache2/weave.meinserver.lan-access.log<br />genügend Auskunft erhalten um den Fehler zu beheben.<br /><br /><br /><span style="font-weight: bold; ">5.) Fazit</span><br /><br />Firefox Sync eignet sich besonders für Menschen die mehrere PCs besitzen, aber auch für Smartphonebesitzer die Mozillas mobile Browser Fennec einsetzen, denn dieser Browser unterstüzt auch Firefox Sync. (aw)<br /><br /><br /><br /><br />]]></content:encoded>
			<category>Verschiedenes</category>
			
			
			<pubDate>Wed, 17 Aug 2011 13:49:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Mobile Weichen mit Varnish und GeoIP</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/mobile-weichen-mit-varnish-und-geoip.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/mobile-weichen-mit-varnish-und-geoip.html</guid>
			<description>Mobile Weichen mittels Varnish, GeoIP und HTTP Headers umleiten</description>
			<content:encoded><![CDATA[In diesem Artikel geht es um eine Mobile Weiche, welche mit dem <link http://de.wikipedia.org/wiki/Varnish _blank external-link-new-window "Öffnet externen Link in neuem Fenster">HTTP Beschleuniger Varnish</link> realisiert wird.<br /><br />Varnish entscheidet anhand des User Agents im Webbrowser und des Herkunftslands der IP, auf welche Seite der Besucher weitergeleitet wird. Um das Herkunftsland zu ermitteln verwenden wir GeoIP.<br /><br />Ein gewisses Grundwissen mit Varnish wird hierbei vorausgesetzt. Falls dies nicht der Fall ist, empfehle ich, folgende Seite zu besuchen: <link https://www.varnish-cache.org/docs/3.0/>https://www.varnish-cache.org/docs/3.0/</link>
<h2>1) Installation</h2>
Die Installation ist schnell erledigt, da fast alles bereits in den Paketquellen von Ubuntu enthalten ist.<br /><br />Varnish und GeoIP installieren
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">apt<span style="color: #000000;">-</span><span style="color: #25BB4D;">get</span> install varnish geoip<span style="color: #000000;">-</span><span style="color: #668080;">bin</span> libnet<span style="color: #000000;">-</span>ip<span style="color: #000000;">-</span>perl libgeo<span style="color: #000000;">-</span>ipfree<span style="color: #000000;">-</span>perl \</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">libgeo<span style="color: #000000;">-</span>ip<span style="color: #000000;">-</span>perl libgeoip<span style="color: #000000;">-</span>dev</div></li></ol></pre></div></div>
Quellcode von GeoIP Plugin herunterladen
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">wget https<span style="color: #000000;">://</span>www<span style="color: #000000;">.</span>varnish<span style="color: #000000;">-</span>cache<span style="color: #000000;">.</span>org<span style="color: #000000;">/</span>trac<span style="color: #000000;">/</span>raw<span style="color: #000000;">-</span>attachment<span style="color: #000000;">/</span>wiki<span style="color: #000000;">/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">\GeoipUsingInlineC<span style="color: #000000;">/</span>GeoIP<span style="color: #000000;">-</span>plugin<span style="color: #000000;">-</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">.</span>tar<span style="color: #000000;">.</span>gz</div></li></ol></pre></div></div>
Entpacken
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">tar xf GeoIP<span style="color: #000000;">-</span>plugin<span style="color: #000000;">-</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">.</span>tar<span style="color: #000000;">.</span>gz</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #668080;">cd</span> GeoIP<span style="color: #000000;">-</span><span style="color: #25BB4D;">plugin</span><span style="color: #000000;">/</span>lib<span style="color: #000000;">/</span></div></li></ol></pre></div></div>Kompilieren&nbsp;&nbsp;&nbsp; <div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">make</div></li></ol></pre></div></div>
Falls das Plugin funktioniert sollte folgende Ausgabe von 
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">make test</div></li></ol></pre></div></div>
entstehen:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">GeoIP <span style="color: #25BB4D;">plugin</span> loaded successfully<span style="color: #000000;">.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Testing IPs<span style="color: #000000;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">195<span style="color: #000000;">.</span>110<span style="color: #000000;">.</span>128<span style="color: #000000;">.</span>11 =<span style="color: #000000;">&gt;</span> IT <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">157<span style="color: #000000;">.</span>166<span style="color: #000000;">.</span>224<span style="color: #000000;">.</span>25 =<span style="color: #000000;">&gt;</span> US <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">212<span style="color: #000000;">.</span>58<span style="color: #000000;">.</span>224<span style="color: #000000;">.</span>138 =<span style="color: #000000;">&gt;</span> GB <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">80<span style="color: #000000;">.</span>91<span style="color: #000000;">.</span>37<span style="color: #000000;">.</span>210 =<span style="color: #000000;">&gt;</span> NO <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">192<span style="color: #000000;">.</span>168<span style="color: #000000;">.</span>0<span style="color: #000000;">.</span>1 =<span style="color: #000000;">&gt;</span> Unknown <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#40;</span>null<span style="color: #000000;">&#41;</span> =<span style="color: #000000;">&gt;</span> Unknown <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li></ol></pre></div></div>
Das kompilierte Plugin in das Verzeichniss von Varnish kopieren
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #668080;">cp</span> geoip_plugin<span style="color: #000000;">.</span><span style="color: #668080;">so</span> <span style="color: #000000;">/</span>etc<span style="color: #000000;">/</span>varnish<span style="color: #000000;">/</span></div></li></ol></pre></div></div>
Ab nun sollten alle Voraussetzungen erfüllt sein und wir können uns der Konfiguration zuwenden.
<h2>2) Konfiguration</h2>
Varnish (siehe Bild, Station 1) überprüft, ob der HTTP User Agent einem mobilen Endgerät zugeordnet werden kann oder nicht. Dies geschieht in der Varnish-Konfiguration mit der Funktion detect_device.<br /><br />Falls es ein mobiler User ist, senden wir ihn zur Länderweiche (siehe Bild, Station 2), andernfalls senden wir ihn an das default Backend (siehe Bild, Station 3). Das GeoIP-Plugin setzt den HTTP Header X-Country-Code anhand der IP-Adresse mit dem jeweiligen Ländercode.<br /><br />Die Länderweiche (siehe Bild, Station 2) entscheidet mit Hilfe des HTTP Headers X-Country-Code welches Backend verwendet werden soll: Falls der Ländercode DE, AT oder CH ist, wird das deutsche Backend (Station 4) verwendet, andernfalls ist das mobile Backend&nbsp;nicht deutsch (Station 5).
<div id="tx_codehighlight_pi1"><div class="code"><pre class="c" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Mobile weiche mithilfe von Varnish und GeoIP</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Lade das Plugin /etc/varnish/geoip_plugin.so</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C<span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#include &lt;dlfcn.h&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#include &lt;stdlib.h&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#include &lt;stdio.h&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #993333;">static</span> <span style="color: #993333;">const</span> <span style="color: #993333;">char</span><span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>get_country_code<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #339933;">*</span> ip<span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    __attribute__<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>constructor<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #993333;">void</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    load_module<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #993333;">const</span> <span style="color: #993333;">char</span><span style="color: #339933;">*</span> symbol_name <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;get_country_code&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #808080; font-style: italic;">/* Lade unser kompiliertes Plugin*/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #993333;">const</span> <span style="color: #993333;">char</span><span style="color: #339933;">*</span> plugin_name <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/etc/varnish/geoip_plugin.so&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #993333;">void</span><span style="color: #339933;">*</span> handle <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* Erstelle Dateihandle */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    handle <span style="color: #339933;">=</span> dlopen<span style="color: #009900;">&#40;</span> plugin_name<span style="color: #339933;">,</span> RTLD_NOW <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>handle <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #808080; font-style: italic;">/* Falls die Datei existiert */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        get_country_code <span style="color: #339933;">=</span> dlsym<span style="color: #009900;">&#40;</span> handle<span style="color: #339933;">,</span> symbol_name <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>get_country_code <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #808080; font-style: italic;">/*  Plugin funktioniert nicht*/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        fprintf<span style="color: #009900;">&#40;</span> stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Error: Could not load GeoIP plugin:<span style="color: #000099; font-weight: bold;">\n</span>%s<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> dlerror<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">else</span> <span style="color: #808080; font-style: italic;">/*  Plugin funktioniert */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;GeoIP plugin loaded successfully.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">else</span> <span style="color: #808080; font-style: italic;">/* Falls die Datei nicht existiert */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        fprintf<span style="color: #009900;">&#40;</span> stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Error: Could not load GeoIP plugin:<span style="color: #000099; font-weight: bold;">\n</span>%s<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> dlerror<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span>C</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># PC Clients allgemein</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend <span style="color: #b1b100;">default</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">host</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">port</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;80&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Mobile Clients die keine Deutsche Sprache sprechen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend mobile_lang_en <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">host</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">port</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;81&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Mobile Clients, welche Deutsch sprechen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend mobile_lang_de <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">host</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">port</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;82&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_recv <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># GeoIP Herkunftsland ermitteln und HTTP Header X-Country-Code setzen. </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    C<span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    VRT_SetHdr<span style="color: #009900;">&#40;</span>sp<span style="color: #339933;">,</span> HDR_REQ<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #006699; font-weight: bold;">\017</span>X-Country-Code:&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>get_country_code<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span> VRT_IP_string</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#40;</span>sp<span style="color: #339933;">,</span> VRT_r_client_ip<span style="color: #009900;">&#40;</span>sp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> vrt_magic_string_end<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span>C</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#No-Cache nur verarbeiten wenn die Seite nicht über einen Proxy und nicht</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#vom MSN-Bot aufgerufen wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">Cache</span><span style="color: #339933;">-</span>Control ~ <span style="color: #ff0000;">&quot;no-cache&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">Via</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;bot|MSIE&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            purge_url<span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Herausfinden ob mobile oder pc User</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    call detect_device<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Das Backend anhand von HTTP Header X-Device sowie X-Country-Code bestimmen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    call routing<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Entscheidung welches Backend verwendet werden muss.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub routing <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Falls ein nicht Mobile User verbindet, verwende default backend.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;pc&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>pass<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Falls Herkunftsland DE, CH oder AT, schicke Traffic auf Mobile Deutsche Weiche</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Country<span style="color: #339933;">-</span>Code <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;DE&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Country<span style="color: #339933;">-</span>Code <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;AT&quot;</span> <span style="color: #339933;">||</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Country<span style="color: #339933;">-</span>Code <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;CH&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">backend</span> <span style="color: #339933;">=</span> mobile_lang_de<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Fall nicht Herkunftsland DE oder AT, schicke Traffic auf Mobile Englische Weiche</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            set req.<span style="color: #202020;">backend</span> <span style="color: #339933;">=</span> mobile_lang_en<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Setze Header X-Device je nach Browseragent</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Der Browseragent verrät uns ob es sich um ein Mobile User handelt.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub detect_device <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Gehe davon ersteinmal aus, dass es ein normaler PC User ist</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;pc&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># LG Handys enthalten LG- im Agentenstring</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;LG-&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Dies hier sind die populärsten Agentenstrings</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;iPhone&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;Android&quot;</span> <span style="color: #339933;">||</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;Symbian&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^BlackBerry&quot;</span> <span style="color: #339933;">||</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^SonyEricsson&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^Nokia&quot;</span> <span style="color: #339933;">||</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^SAMSUNG&quot;</span> <span style="color: #339933;">||</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^LG&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;   webOS&quot;</span> <span style="color: #339933;">||</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;Windows Phone&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Palm Telefon Useragent string</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^PalmSource&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Andere bekannte Handy Browseragenten</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">user</span><span style="color: #339933;">-</span>agent ~</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">&quot;(.*Blackberry.*|.*BlackBerry.*|.*Blazer.*|.*Ericsson.*|.*htc.*|.*Huawei.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*iPhone.*|.*iPod.*|.*MobilePhone.*|.*Motorola.*|.*nokia.*|.*Novarra.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*O2.*|.*Palm.*|.*Samsung.*|.*Sanyo.*|.*Smartphone.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*SonyEricsson.*|.*Symbian.*|.*Toshiba.*|.*Treo.*|.*vodafone.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*Xda.*|^Alcatel.*|^Amoi.*|^ASUS.*|^Audiovox.*|^AU-MIC.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^BenQ.*|^Bird.*|^CDM.*|^DoCoMo.*|^dopod.*|^Fly.*|^Haier.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^HP.*iPAQ.*|^i-mobile.*|^KDDI.*|^KONKA.*|^KWC.*|^Lenovo.*|^LG.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^NEWGEN.*|^Panasonic.*|^PANTECH.*|^PG.*|^Philips.*|^portalmmm.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^PPC.*|^PT.*|^Qtek.*|^Sagem.*|^SCH.*|^SEC.*|^Sendo.*|^SGH.*|^Sharp.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^SIE.*|^SoftBank.*|^SPH.*|^UTS.*|^Vertu.*|.*Opera.Mobi.*|.*Windows.CE.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^ZTE.*|.*LG.*|.*SAMSUNG.*|.*webOS|^Nokia*)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Falls es sich um Tablets handelt, verwende das normale Backend</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;(.*GT-P1000M.*|.*Xoom.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*GT-P7100 Build/HRI83.*|.*A500 Build/HRI66.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*iPad.*|.*iPod.*)&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;pc&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div>
Die Konfigurationsdatei kann <link fileadmin/user_upload/news/administration/varnish-mobileweiche.vcl - download "Leitet Herunterladen der Datei ein">hier</link> heruntergeladen werden.
<h2>3) Fazit</h2>
Varnish ist ein solider HTTP-Beschleuniger, welcher zu deutlich mehr imstande ist, als man denkt.<br /><br />Dank der Plugin-Funktionalität der eigenen Skriptsprache VCL, sowie C-Code Unterstützung innerhalb einer Konfigurationsdatei, ist es möglich, eine zuverlässige mobile Weiche in kurzer Zeit zu erstellen. 
In eigener Sache:<br />Funktionen mit Hilfe von C in den Varnish einzubauen ist nicht immer ganz trivial. Um Ziele für Mobiluser auf einzelnen Domains leichter verwalten zu können haben wir uns ein Webinterface geschrieben, dass viele Weiterleitungsmöglichkeiten abbildet. Auf unserer Hosting-Seite finden sich zum Beispiel fertige <link http://www.lamp-hosting.de/enterprise/webserver.html>Webserver mit Varnish</link> und Mobiluser Targeting
(aw)]]></content:encoded>
			<category>Verschiedenes</category>
			
			
			<pubDate>Mon, 08 Aug 2011 14:49:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Varnish3 unter Ubuntu 10.4 für Wordpress und TYPO3-Seiten </title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/varnish3-unter-ubuntu-104-fuer-wordpress-und-typo3-seiten.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/varnish3-unter-ubuntu-104-fuer-wordpress-und-typo3-seiten.html</guid>
			<description>Mit dem Varnish Cache lässt sich die Performance von TYPO3-Seiten und WordPress-Blogs enorm...</description>
			<content:encoded><![CDATA[Seit dem 16.6.2011 gibt es die neue Version 3.0 des <link https://www.varnish-cache.org/ - external-link-new-window "Öffnet externen Link in neuem Fenster">Vanish-Caches.</link> Wir haben ja schon in einigen anderen Artikeln gezeigt wie sich Webseiten mit dem Varnish beschleunigen lassen. Beim Update auf den Varnish3 mussten wir einige Änderungen an unserer Konfiguration vornehmen.
Die Installation von Varnish3 ist dank vorhandener Pakete für Ubuntu sehr einfach
http://www.varnish-cache.org/installation/ubuntu
Hier erst einmal das komplette VCL für einen Cache für mehrere TYPO3-Webseiten und einen größeren WordPress-Blog.
<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend default <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .host = <span style="color: #ff0000;">&quot;xxx.xxx.xxx.xxx&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .port = <span style="color: #ff0000;">&quot;80&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> backend default2 <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .host = <span style="color: #ff0000;">&quot;xxx.xxx.xxx.xxx&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .port = <span style="color: #ff0000;">&quot;80&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .host = <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .port = <span style="color: #ff0000;">&quot;8080&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_recv <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">##No-Cache nur verarbeiten wenn die Seite nicht über einen Proxy und nicht </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">#vom MSN-Bot aufgerufen wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Cache-Control ~ <span style="color: #ff0000;">&quot;no-cache&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Via <span style="color: #000000; font-weight: bold;">||</span> req.http.User-Agent ~ <span style="color: #ff0000;">&quot;bot|MSIE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            ban <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.url<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">##TYPO3-Backend nicht cachen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.cookie ~ <span style="color: #ff0000;">&quot;be_typo_user&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.host ~ <span style="color: #ff0000;">&quot;domain.tld&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">else</span><span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #666666; font-style: italic;">##Cookies von TYPO3-Seiten löschen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">unset</span> req.http.Cookie;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.x-forwarded-for<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">set</span> req.http.X-Forwarded-For =</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            req.http.X-Forwarded-For + <span style="color: #ff0000;">&quot;, &quot;</span> + client.ip;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">set</span> req.http.X-Forwarded-For = client.ip;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">##Richtiges Backend wählen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.host ~ <span style="color: #ff0000;">&quot;domain.tld&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #000000; font-weight: bold;">set</span> req.backend = default2;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.host ~ <span style="color: #ff0000;">&quot;lb1.lamp-solutions.de&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #000000; font-weight: bold;">set</span> req.backend = <span style="color: #7a0874; font-weight: bold;">local</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #000000; font-weight: bold;">set</span> req.backend = default;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;GET&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;HEAD&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;PUT&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;POST&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;TRACE&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;OPTIONS&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;DELETE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#         /* Non-RFC2616 or CONNECT which is weird. */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pipe<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;GET&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;HEAD&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#         /* We only deal with GET and HEAD by default */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Authorization <span style="color: #000000; font-weight: bold;">||</span> req.http.Cookie<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#         /* Not cacheable by default */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>lookup<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#Wenn Seite vom Server geholt wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_fetch <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">##No-Cache vom Server auswerten damit Varnish kapiert wenn TYPO3-Cache geleert wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>beresp.http.Pragma ~ <span style="color: #ff0000;">&quot;nocache&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Via <span style="color: #000000; font-weight: bold;">||</span> req.http.User-Agent ~ <span style="color: #ff0000;">&quot;bot|MSIE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>hit_for_pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"># Wenn Anfrage aus dem Cache geholt wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_hit <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Cache-Control ~ <span style="color: #ff0000;">&quot;no-cache&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Via <span style="color: #000000; font-weight: bold;">||</span> req.http.User-Agent ~ <span style="color: #ff0000;">&quot;bot|MSIE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000000; font-weight: bold;">set</span> obj.ttl = 0s;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">return</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>deliver<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li></ol></pre></div></div>
Vor allem ist zu beachten, dass es die Option <span style="font-weight: bold;">purge_url</span><span style="font-style: italic;"></span> nicht mehr gibt. Statt dessen gibt es die neue Option <span style="font-weight: bold;">ban</span> http://www.varnish-cache.org/docs/trunk/tutorial/purging.html
Im Abschnitt <span style="font-weight: bold;">vcl_fetch</span> ist seit der Version 3.0 die Rückgabe (pass) nicht mehr erlaubt, daher ist sie durch <span style="font-weight: bold;">hit_for_pass</span> ersetzt worden.
Unbedingt beachten sollten man auch, dass es bis zur Version 2.1 noch erlaubt war 
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.http.X-Forwarded-For  <span style="color: #ff0000;">&quot;, &quot;</span> client.ip;</div></li></ol></pre></div></div>
zu schreiben.
Ab der Version 3.0 ist die Syntax etwas strenger geworden:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.http.X-Forwarded-For + <span style="color: #ff0000;">&quot;, &quot;</span> + client.ip;</div></li></ol></pre></div></div>]]></content:encoded>
			<category>Tuning</category>
			
			
			<pubDate>Tue, 21 Jun 2011 16:07:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>LSI Raid-Controller von Dell über Nagios überwachen</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/monitoring/monitoring-einzelansicht/artikel/lsi-raid-controller-von-dell-ueber-nagios-ueberwachen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/monitoring/monitoring-einzelansicht/artikel/lsi-raid-controller-von-dell-ueber-nagios-ueberwachen.html</guid>
			<description>In vielen Servern, zum Beispiel der Firma Dell, werden auch Raid-Controller von LSI verbaut. 
Bei...</description>
			<content:encoded><![CDATA[In vielen Servern, zum Beispiel der Firma Dell, werden auch Raid-Controller von LSI verbaut. 
Bei aktuellen Servern erkennt man anhand des Befehls &quot;lspci&quot; folgende Bezeichnungen für die Controller, wobei es sich um den gleichen Typ handelt:
02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 5<br />01:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 1078
Ältere Server haben teilweise einen älteren Controller im Einsatz.
02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 4
<h2></h2>
<h2>Das Tool megactl</h2>
Um die genannten Raid-Controller abzufragen gibt es das Tool <link http://sourceforge.net/projects/megactl/ - external-link-new-window "Öffnet externen Link in neuem Fenster">megactl</link>. Für aktuelle Ubuntu- und Debian-Systeme gibt es dafür auch ein fertiges DEB-Paket, welche über eine <link http://hwraid.le-vert.net/debian/pool-sid/ - external-link-new-window "Öffnet externen Link in neuem Fenster">Fremdquelle</link> bezogen werden kann.
Hier findet man neben einer 64 Bit auch eine 32 Bit Version.
<link http://hwraid.le-vert.net/debian/pool-sid/megactl_0.4.1+svn20090725.r6-1_amd64.deb>megactl_0.4.1+svn20090725.r6-1_amd64.deb<br /></link><link http://hwraid.le-vert.net/debian/pool-sid/megactl_0.4.1+svn20090725.r6-1_i386.deb>megactl_0.4.1+svn20090725.r6-1_i386.deb</link>
<h2></h2>
<h2>Installation von megactl</h2>
Auf einem Ubuntu- oder Debian-Server wird das davor heruntergeladene Paket wie folgt installiert:
dpkg -i megactl_0.4.1+svn20090725.r6-1_i386.deb
Auf einem 64 Bit System wird davor das Paket libc6-i386 benötigt.
apt-get install libc6-i386
<h2>Status des Raid-Controllers abfragen</h2>

Den Status eines LSI MegaRAID-Controllers erhält man nach erfolgreicher Installation von megactl je nach eingebautem Typ mit den Befehlen:
megasasctl&nbsp; (Dell PowerEdge Expandable RAID controller 5 oder MegaRAID SAS)
megactl (Dell PowerEdge Expandable RAID controller 4)
<h3></h3>
<h3>Bash-Skript zur automatischen Abfrage</h3>
Damit die Abfrage automatisch über Cron stattfindet oder um den Status des Controllers über Nagios prüfen zu lassen kann man ein entsprechendes Skript schreiben das zum Beispiel so aussehen kann:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;"> &quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># Status fuer Nagios bereitstellen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">LOGFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>raid.txt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$LOGFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># Abfrage des Status</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">CHECKRAID</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>megasasctl <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'DEGRADED\|failure'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># Status ok</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$?</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #666666; font-style: italic;"># Status Fehler - E-Mail senden</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(megasasctl)</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mail admin<span style="color: #000000; font-weight: bold;">@</span>deinedom.tld <span style="color: #660033;">-s</span><span style="color: #ff0000;">&quot;<span style="color: #007800;">$(hostname)</span> RAID Fehler&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #666666; font-style: italic;"># Status Rebuild ?</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #007800;">RAIDDETAILS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>megasasctl <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> rebuild<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$?</span> == <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #666666; font-style: italic;"># Falls kein Rebuild - kritisch</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li></ol></pre></div></div>
<h3></h3>
<h3>Einbindung in den Nagios</h3>
Den dadurch bereitgestellten Status kann nun auch von Nagios abgefragt werden. Es werden folgende drei Werte bereitgestellt:
0 -&gt; Status: ok<br />1 -&gt; Status: warning<br />2 -&gt; Status: critical
<br />Dazu kann folgendes Nagios-Plugin eingesetzt werden.
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATE_OK</span>=<span style="color: #000000;">0</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATE_WARNING</span>=<span style="color: #000000;">1</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATE_CRITICAL</span>=<span style="color: #000000;">2</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">host</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">hostname</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">LOGFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>raid.txt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATUS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$LOGFILE</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;WARNING - <span style="color: #007800;">$host</span> - RAID rebuilding&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$STATE_WARNING</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;CRITICAL - <span style="color: #007800;">$host</span> - RAID critical&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$STATE_CRITICAL</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">&quot;Null&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> CRITICAL - <span style="color: #007800;">$host</span> -  RAID unknown</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$STATE_UNKNOWN</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> OK - <span style="color: #007800;">$host</span> -  RAID OK</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$STATE_OK</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li></ol></pre></div></div>
<h2></h2>
<h2>Auf der sicheren Seite</h2>
Viele Hoster setzen Raid-Controller ein, die wie man sehen kann, mit einfachen mitteln abgefragt werden können. Leider bieten die wenigsten ein entsprechendes Monitoring um zu warnen, falls eine Festplatte doch mal aus den Verbund ausfällt.
Die Redundanz eines Raid-Systems kann nur dann etwas nutzen, wenn auch rechtzeitig ein Problem erkannt wird bevor es zum Desaster kommt. (ch)]]></content:encoded>
			<category>Monitoring</category>
			
			
			<pubDate>Thu, 16 Jun 2011 17:03:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Zugriffsstatistiken auf varnish für einzelne Vhosts  mit awstats anlegen</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/zugriffsstatistiken-auf-varnish-fuer-einzelne-vhosts-mit-awstats-anlegen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/zugriffsstatistiken-auf-varnish-fuer-einzelne-vhosts-mit-awstats-anlegen.html</guid>
			<description>Mit einigen Anpassungen lässt sich der Varnishnca-Deamon dazu bringen Logfiles zu erstellen, die...</description>
			<content:encoded><![CDATA[Wird ein Webserver durch einen Cache wie den http-accelerator varnish erfolgreich getunt, gelangen nur noch wenige Anfragen auf den Webserver. Für aussagekräftige Statistiken reichen die Anfragen auf dem Webserver nicht mehr aus. Die Statistiken lassen sich dann besser direkt aus den Zugriffen auf dem Loadbalancer erstellen.<br /><br />
<h2>1) varnishncsa anpassen</h2>
Joenio Costa hat unter http://gitorious.org/varnisnncsa-vhost einen Patch für den Logdeamon von varnish veröffentlicht, mit der das Logformat der bei Ubuntu 10.4 beiliegenden Varnish-Version so abgeändert wird, dass der Domainname an den die Anfrage geht mit ins Logfile geschrieben wird. <br />Für den Patch gibt es fertige Debian Pakete. Damit der geänderte Logdeamon unter Ubuntu 10.4 funktioniert, muss das init-Script leicht angepasst werden. Der user muss von varnishlog in root geändert werden.<br />Unter dem Artiekel bieten wir ein angepasstes Archiv zum Download an.<br />Mit dem Archiv ist der angepasste Logdeamon schnell eingerichtet<br />&nbsp;&nbsp;&nbsp; <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">wget</span> foobar.lamp-solutions.de<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>varnishncsa-vhost_0.1-<span style="color: #000000;">1</span>_ubuntu.deb</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> varnishncsa-vhost_0.1-<span style="color: #000000;">1</span>_ubuntu.deb</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>varnishncsa-vhost</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">VARNISHNCSA_ENABLED</span>=<span style="color: #000000;">1</span> setzen</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>varnishncsa </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">VARNISHNCSA_ENABLED</span>=<span style="color: #000000;">0</span> setzen</div></li></ol></pre></div></div>
<h2>2) awstats anpassen</h2>
Jeder Vhost bekommt jetzt eine eigene Konfigurationsdatei. Diese muss drei wichtige Einstellungen enthalten
<div class="indent"><br />&nbsp;&nbsp;&nbsp; <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">LogFile</span>=<span style="color: #ff0000;">&quot;/var/log/varnish/varnishncsa-vhost.log&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">LogFormat = <span style="color: #ff0000;">&quot;%virtualname %host %other %logname %time1 <span style="color: #000099; font-weight: bold;">\</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">%methodurl %code %bytesd %refererquot %uaquot&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">SiteDomain</span>=<span style="color: #ff0000;">&quot;&lt;Domainname&gt;&quot;</span></div></li></ol></pre></div></div><br /><br />Alle weiteren Einstellungen können wie gewohnt vorgenommen werden.<br /><br />
<h2>3) Fazit</h2>
Mit dem Erscheinen von Varnish 3.0, das zur Zeit als beta-Version vorliegt, wird der Logdeamon von Hause aus individuelle Logformate unterstützen. Die Anpassungen werden dann nicht mehr nötig sein. Da mit der LTS-Version von Ubuntu 10.04 und anderen großen Distributionen noch einige Zeit der Vernish 2.1.x Standard sein wird, ist die hier beschriebene Lösung eine recht einfache Möglichkeit Zugriffsstatistiken für einen Varnish-Cache oder Loadbalancer pro Vhost zu führen.</div>]]></content:encoded>
			<category>Tuning</category>
			
			
			<pubDate>Mon, 23 May 2011 12:02:00 +0200</pubDate>
			<enclosure url="http://foobar.lamp-solutions.de/uploads/media/varnishncsa-vhost_0.1-1_ubuntu.deb" length ="7398" type="application/x-debian-package" />
		</item>
		
		<item>
			<title>Höchverfügbarer http-Loadbalancer mit varnish und heartbeat unter Ubuntu 10.04</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/hoechverfuegbarer-http-loadbalancer-mit-varnish-und-heartbeat-unter-ubuntu-1004.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/hoechverfuegbarer-http-loadbalancer-mit-varnish-und-heartbeat-unter-ubuntu-1004.html</guid>
			<description>Mit dem Varnish-Cache als http-Accelerator lässt sich unter Ubuntu zusammen mit heartbeat sehr...</description>
			<content:encoded><![CDATA[<h2>1)hearbeat und varnish installieren.</h2>
<br />Alle wichtigen Pakete sind im offiziellen Repository von Ubuntu enthalten:<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> varnish heartbeat</div></li></ol></pre></div></div><br /><br />
<h2>2)heartbeat configurieren</h2>
Wir wollen, dass die beiden Loadbalancer über eine oder mehrere hochverfügbare Hearbeat IP(s) über das Internet erreichbar sind. <br /><br />Dazu reicht eine recht einfache Standard-Konfiguration für heartbeat<br /><br />Die Datei /etc/ha.d/authkeys benötigt in etwa diesen Inhalt:<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">auth <span style="color: #000000;">2</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">2</span> sha1 <span style="color: #000000; font-weight: bold;">&lt;</span>passwort<span style="color: #000000; font-weight: bold;">&gt;</span></div></li></ol></pre></div></div><br /><br />In der Datei /etc/ha.d/ha.cf nehmen wir die wichtigsten Grundkonfigurationen vor<br /><br />CODE:bash:logfile /var/log/ha-log <br />logfacility local0 <br />keepalive 2 <br />deadtime 30 <br />initdead 120 <br />ucast eth0 &lt;IP-Rechner1&gt;<br />ucast eth0 &lt;IP-Rechner2&gt;<br />udpport 694 <br />auto_failback on <br />node lb1 <br />node lb2 <br /><br />Auf die einzelnen Einstellungen wollen wir hier im Detail nicht eingehen. Wichtig ist, dass in die beiden Zeilen ucast eth0 &lt;IP-Rechner1&gt; und ucast eth0 &lt;IP-Rechner2&gt; die beiden festen IP-Adressen der Server eingetragen werden. Die Bezeichnungen für die beiden Nodes in den Zeilen node lb1 , node lb2&nbsp; müssen unbedingt der Ausgabe von uname -n auf den Systemen entsprechen.<br /><br />Als letztes ist noch die Datei<br />/etc/ha.d/haressources wichtig.<br /><br />lb1 &lt;hearbeat-IP1&gt; &lt;hearbeat-IP2&gt; varnishd<br /><br />Der erste Wert gibt an, dass wenn beide Systeme online sind, lb1 die Ressourcen übernehmen soll. Danach folgen durch ein Leerzeichen alle IP-Adressen die hearbeat verwalten soll. Als letztes müssen wir dafür sorgen, dass beim Umschalten der IP-Adressen der Vanish-Cache neu gestartet wird. Sonst merkt das Programm nicht, dass eventuell neue Ips vorhanden sind.<br /><br />Da es in den Ubuntu Paketen von Hearbeat kein fertiges Script vorhanden ist um den Varnish neu zu starten, müssen wir dieses unter <br /><br />/etc/ha.d/resource.d/varnishd selbst anlegen. <br />Es reicht ein sehr einfacher Inhalt:<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">in</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    start<span style="color: #7a0874; font-weight: bold;">&#41;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>varnish restart </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">;;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    stop<span style="color: #7a0874; font-weight: bold;">&#41;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>varnish restart </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">;;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    status<span style="color: #7a0874; font-weight: bold;">&#41;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">;;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">esac</span></div></li></ol></pre></div></div><br /><br />
<h2>3) varnish Konfigurieren</h2>
Die Beispieldateien für den Varnish die uns die Ubuntu-Pakete mitliefern sind schon sehr umfangreich.<br /><br />In der Datei /etc/default/varnish ist der wichtigste Schritt den Cache auf dem http-Port 80 zu legen:<br /><br />DAEMON_OPTS=&quot;-a :80 \ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -f /etc/varnish/default.vcl \ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -S /etc/varnish/secret \ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -s file,/data/varnish/$INSTANCE/varnish_storage.bin,2G&quot; <br /><br />Das eigentliche Backend wird in diesem Fall in der Datei /etc/varnish/default.vcl definiert.<br />Die Einstellungen hier hängen stark von den Bedürfnissen ab. <br /><br />Einen guten Einstieg in die Möglichkeiten liefert die offizielle Webseite<br /><br />http://www.varnish-cache.org/docs/2.1/<br /><br />Wir stellen hier mal eine sehr einfache Konfiguration vor:<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend node0 <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  .host = <span style="color: #ff0000;">&quot;&lt;hostip1&gt;&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  .port = <span style="color: #ff0000;">&quot;80&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  .probe = <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .url = <span style="color: #ff0000;">&quot;/test.html&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .timeout = <span style="color: #000000;">50</span> ms; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .interval = 1s; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .window = <span style="color: #000000;">10</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .threshold = <span style="color: #000000;">8</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend node1 <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  .host = <span style="color: #ff0000;">&quot;&lt;hostip2&gt;&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  .port = <span style="color: #ff0000;">&quot;80&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  .probe = <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .url = <span style="color: #ff0000;">&quot;/test.html&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .timeout = <span style="color: #000000;">100</span> ms; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .interval = 1s; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .window = <span style="color: #000000;">10</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           .threshold = <span style="color: #000000;">8</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">director back1 random <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#123;</span> .backend = node0; .weight = <span style="color: #000000;">1</span>; <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#123;</span> .backend = node1; .weight = <span style="color: #000000;">1</span>; <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_recv <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.x-forwarded-for<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">set</span> req.http.X-Forwarded-For = </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            req.http.X-Forwarded-For <span style="color: #ff0000;">&quot;, &quot;</span> client.ip; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">set</span> req.http.X-Forwarded-For = client.ip; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #000000; font-weight: bold;">set</span> req.backend = back1; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;GET&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;HEAD&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;PUT&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;POST&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;TRACE&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;OPTIONS&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;DELETE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pipe<span style="color: #7a0874; font-weight: bold;">&#41;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;GET&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;HEAD&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Authorization <span style="color: #000000; font-weight: bold;">||</span> req.http.Cookie<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>lookup<span style="color: #7a0874; font-weight: bold;">&#41;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li></ol></pre></div></div><br /><br />
<h2>4) Fazit:</h2>
Als Test haben wir eine Webseite mit über 500 Einzelseiten mit einem kleinen Wget-Script komplett abgerufen. Über eine 100Mbit Anbindung werden dabei 20MB in ca. 1,8 Sekunden geholt. Das reicht schon an die Grenze der Leitungsgeschwindigkeit. Wenn wir einen der beiden Loadbalancer neu starten, übernimmt der zweite die Ressourcen so schnell, dass sich von außen das Umschaltprozess nicht feststellen lässt.<br /><br />]]></content:encoded>
			<category>Tuning</category>
			
			
			<pubDate>Mon, 16 May 2011 15:38:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>3ware RAID Controller überwachen und Firmware updaten</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/3ware-raid-controller-ueberwachen-und-firmware-updaten.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/3ware-raid-controller-ueberwachen-und-firmware-updaten.html</guid>
			<description>3ware RAID-Controller sind weit verbreitet. Auch bei Serversystemen  finden diese auch durch...</description>
			<content:encoded><![CDATA[3ware RAID-Controller sind weit verbreitet. Auch bei Serversystemen  finden diese auch durch niedrigem Preis oft Verwendung. Im folgenden  möchten wir daher auf Überwachungsmöglichkeiten des RAIDs eingehen,  sowie auf das Upgrade der Firmware, da die Geräte oft mit sehr alter  Firmware Ihren Weg zum Käufer finden.<br /> 
<h2> 1) Benutzung des Tools tw_cli</h2>
 3ware stellt mit Command Line Interface Tool tw_cli eigentlich alles  bereit, was man benötigt um das RAID zu steuern. Man kann neue Festplatten  erkennen lassen, das RAID auch nach dem Austausch einer defekten  Festplatte rebuilden lassen, oder das RAID verifizieren lassen. <br /> <br /> Vorerst lassen wir uns anzeigen, welche Controller vorhanden sind.<br /> <br /> <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">//</span>server<span style="color: #000000; font-weight: bold;">&gt;</span> show</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> Ctl   Model        <span style="color: #7a0874; font-weight: bold;">&#40;</span>V<span style="color: #7a0874; font-weight: bold;">&#41;</span>Ports  Drives   Units   NotOpt  RRate   VRate  BBU</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #660033;">------------------------------------------------------------------------</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> c4    9650SE-2LP   <span style="color: #000000;">2</span>         <span style="color: #000000;">2</span>        <span style="color: #000000;">1</span>       <span style="color: #000000;">0</span>       <span style="color: #000000;">1</span>       <span style="color: #000000;">1</span>      - </div></li></ol></pre></div></div><br /> <br /> Wollen wir diesen Controller im folgenden ansprechen, bzw Steuern müssen wir die Bezeichnun &quot;c4&quot; benutzen.<br /> <br /> Um sich das Array anzeigen zu lassen, gibt man einfach folgendes ein:<br /> <br /> <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">//</span>server<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>c4 show</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> Unit  UnitType  Status         <span style="color: #000000; font-weight: bold;">%</span>RCmpl  <span style="color: #000000; font-weight: bold;">%</span>V<span style="color: #000000; font-weight: bold;">/</span>I<span style="color: #000000; font-weight: bold;">/</span>M  Stripe  Size<span style="color: #7a0874; font-weight: bold;">&#40;</span>GB<span style="color: #7a0874; font-weight: bold;">&#41;</span>  Cache  AVrfy</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #660033;">------------------------------------------------------------------------------</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> u0    RAID-<span style="color: #000000;">1</span>    OK             -       -       -       <span style="color: #000000;">1862.63</span>   Ri     OFF    </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> VPort Status         Unit Size      Type  Phy Encl-Slot    Model</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #660033;">------------------------------------------------------------------------------</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> p0    OK             u0   <span style="color: #000000;">1.82</span> TB   SATA  <span style="color: #000000;">0</span>   -            SAMSUNG HD204UI     </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> p1    OK             u0   <span style="color: #000000;">1.82</span> TB   SATA  <span style="color: #000000;">1</span>   -            SAMSUNG HD204UI</div></li></ol></pre></div></div><br /> <br /> Man bekommt demnach alle wichtigen Informationen über das RAID  ausgegeben. Will man feststellen welche Firmware der RAID Controller  besitzt, welche wir im dritten Schritt des Artikels upgraden werden, so  muss man den show Befehl um den Parameter &quot;all&quot; erweitern.<br /> <br /> <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">//</span>server<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>c4 show all</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">/</span>c4 Driver Version = 2.26.02.012</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> ...</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> ...</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">/</span>c4 Firmware Version = FE9X 4.10.00.007</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">/</span>c4 Bios Version = BE9X 4.08.00.002</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">/</span>c4 Boot Loader Version = BL9X 3.08.00.001</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> ...</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> ...</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">/</span>c4 Controller Bus Type = PCIe</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> Unit  UnitType  Status         <span style="color: #000000; font-weight: bold;">%</span>RCmpl  <span style="color: #000000; font-weight: bold;">%</span>V<span style="color: #000000; font-weight: bold;">/</span>I<span style="color: #000000; font-weight: bold;">/</span>M  Stripe  Size<span style="color: #7a0874; font-weight: bold;">&#40;</span>GB<span style="color: #7a0874; font-weight: bold;">&#41;</span>  Cache  AVrfy</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #660033;">------------------------------------------------------------------------------</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> u0    RAID-<span style="color: #000000;">1</span>    OK             -       -       -       <span style="color: #000000;">1862.63</span>   Ri     OFF    </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> VPort Status         Unit Size      Type  Phy Encl-Slot    Model</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #660033;">------------------------------------------------------------------------------</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> p0    OK             u0   <span style="color: #000000;">1.82</span> TB   SATA  <span style="color: #000000;">0</span>   -            SAMSUNG HD204UI     </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> p1    OK             u0   <span style="color: #000000;">1.82</span> TB   SATA  <span style="color: #000000;">1</span>   -            SAMSUNG HD204UI</div></li></ol></pre></div></div><br /> <br /> Die Ausgabe haben wir etwas gekürzt, diese wäre ansonsten etwas zu lange  gewesen. Dort sind zudem Seriennummer, Produktbeschreibung oder die Art  der Anbindung angegeben.<br /> 
<h2> 2) Überwachung des RAIDs</h2>
 Wie oben beschrieben, lässt sich der Status des RAID Controllers stets  abfragen, jedoch hat man als Administrator mehrerer Server weder die  Zeit, noch die Lust darauf das manuell zu erledigen.<br /> <br /> <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"># tw_cli binary location</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">TWCLI</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>3ware<span style="color: #000000; font-weight: bold;">/</span>tw_cli</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">ADMIN</span>=<span style="color: #ff0000;">&quot;admin@email.de&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># controller name</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">CONTROLLER</span>=c4</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># server-name</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">SERVERNAME</span>=sever-mit-wichtigem-RAID</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># get complete status</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATUS_CONTROLLER</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$TWCLI</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CONTROLLER</span> show<span style="color: #000000; font-weight: bold;">`</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># check for RAID status</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATUS_RAID</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS_CONTROLLER</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^u0&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $3; }'</span><span style="color: #000000; font-weight: bold;">`</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS_RAID</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;OK&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;RAID ERROR DETECTED:&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;====================&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Server : <span style="color: #007800;">$SERVERNAME</span>&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Time   : <span style="color: #780078;">`date`</span>&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS_CONTROLLER</span>&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; &quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS_CONTROLLER</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mail <span style="color: #007800;">$ADMIN</span> <span style="color: #660033;">-s</span><span style="color: #ff0000;">&quot;(<span style="color: #007800;">$SERVERNAME</span>) RAID ERROR DETECTED!!&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># check for disk status</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATUS_DISKS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS_CONTROLLER</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^p[[:digit:]]&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $2; }'</span><span style="color: #000000; font-weight: bold;">`</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS_DISKS</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">&quot;^OK$&quot;</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;#################################################&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;#             DISK ERROR DETECTED:              #&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;#################################################&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS_CONTROLLER</span>&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS_CONTROLLER</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mail <span style="color: #007800;">$ADMIN</span> <span style="color: #660033;">-s</span><span style="color: #ff0000;">&quot;(<span style="color: #007800;">$SERVERNAME</span>) DISK ERROR DETECTED!!&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></div></li></ol></pre></div></div><br /> <br /> Das Skript teilt einem somit per E-Mail mit, wenn es Probleme gibt. Man sollte es am besten per Cronjob überwachen.<br /> 
<h2> 3) 3ware RAID Controller Firmware Update</h2>
 <br /> 3ware RAID Controller gibt es schon lange. Damit diese vor allem durch  neue Kernel-Versionen, bzw. andere Hardware unterstützt werden und vor  allem auch die angeschlossenen Festplatten unterstützen sollte man die  Firmware soweit es geht aktuell halten.<br /> <br /> Die aktuelle Firmware Version finden Sie im <link http://kb.lsi.com/DownloadsCategory215.aspx _blank external-link-new-window "Öffnet externen Link in neuem Fenster">Softwareverzeichnis seitens  des Herstellers</link> <br /> <br /> Hat man sich die Datei heruntergeladen, muss man diese nur noch  entpacken. Die wichtige Datei dabei ist die *.img Datei. Danach startet  man wieder das Command Line Interface <span style="font-weight: bold;">tw_cli</span>. Bevor man loslegt, sollte  man sich jedoch ansehen, welche Kernel von der jeweiligen Version  unterstützt werden, ansonsten kann es zu Problemen kommen.<br /> <br /> <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">//</span>server<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>c4 update <span style="color: #007800;">fw</span>=absoluter_Pfad_zur_Firmware-Datei</div></li></ol></pre></div></div><br /> <br /> Wichtig dabei ist, dass der absolute Pfad angegeben wird, da die Datei  sonst nicht gefunden wird. Danach wird einem angezeigt, ob der  Controller Kompatibel ist und man muss die Prozedur nochmals mit &quot;Y&quot;  bestätigen, bevor die Firmware aufgespielt wird. Nach in der Regel  wenigen Sekunden ist der Vorgang abgeschlossen und nach einem Neustart  des Servers arbeitet der Controller auch mit der neuen Firmware.]]></content:encoded>
			<category>Verschiedenes</category>
			
			
			<pubDate>Thu, 05 May 2011 14:54:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Varnish zur Beschleunigung von HTTP Anfragen mit Apache2</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/varnish-zur-beschleunigung-von-http-anfragen-mit-apache2.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/varnish-zur-beschleunigung-von-http-anfragen-mit-apache2.html</guid>
			<description>Varnish bietet eine schnelle und einfache Möglichkeit den Webserver stark zu entlasten und HTTP...</description>
			<content:encoded><![CDATA[Vor allem auf sehr stark besuchten Seiten tritt häufig das Problem auf, dass zu Stoßzeiten Ressourcen sehr knapp werden. Dort wo Op-Code Caching nicht mehr ausreichend ist kommt daher die Software <link http://omninoggin.com/web-development/block-unwanted-spam-bots-using-varnish-vcl/ - external-link-new-window "Öffnet externen Link in neuem Fenster">varnish</link> zum Einsatz. Das Programm, was vor den Webserver geschalten wird, kann nicht nur cachen, sondern auch balancen. Im folgenden wollen wir jedoch auf die Caching-Eigenschaften eingehen.<br /><br />
<h2>1) Problemstellung</h2>
Zu Stoßzeiten kann es schon einmal vorkommen, dass binnen weniger Minuten mehrere tausend User auf eine Webseite stürmen. In anderen Artikeln haben wir schon die Möglichkeiten von Op-Code Caching-Möglichkeiten verglichen. Dennoch wird dadurch der Webserver und eventuell eine angebundene MySQL-Datenbank beansprucht. Anders ist es beim varnish.<br /><br />
<h2>2) Installation</h2>
varnish ist in den Quellen von Ubuntu zu finden. Daher ist es recht schnell installiert<br /><br />apt-get install varnish<br /><br />
<h2>3) Konfiguration</h2>
Varnish bietet in seiner Grundinstallation schon sehr viele Beispiele, welche auskommentiert sind. Wichtig sind jedoch folgende Einstellungen:<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>varnish<span style="color: #000000; font-weight: bold;">/</span>default.vcl</div></li></ol></pre></div></div><br /><br />
<h3>3.1) Webserver hinter varnish angeben</h3>
<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend default <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .host = <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .port = <span style="color: #ff0000;">&quot;8080&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li></ol></pre></div></div><br /><br />In diesem fall lauschen Webserver und damit die Webseiten auf der privaten IP 127.0.0.1 mit Port 8080. Ein direkter Zugriff von außen ist demnach nicht mehr Möglich. Die weiteren Konfigurationen sind eher an den jeweiligen Server anzupassen, bzw. auf die Webseiten dahinter. Man kann z.B. festlegen, was gecached werden sollen, diese Einstellungen reichen von Anfragetypen bis zu Cookies und sind sehr vielfältig.<br /><br />
<h3>3.2) IP und Port von varnish konfigurieren</h3>
<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>varnish</div></li></ol></pre></div></div><br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">DAEMON_OPTS</span>=<span style="color: #ff0000;">&quot;-a :80 <span style="color: #000099; font-weight: bold;">\</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">             -f /etc/varnish/default.vcl <span style="color: #000099; font-weight: bold;">\</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">             -S /etc/varnish/secret <span style="color: #000099; font-weight: bold;">\</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">             -s file,/data/varnish/<span style="color: #007800;">$INSTANCE</span>/varnish_storage.bin,1G&quot;</span></div></li></ol></pre></div></div><br /><br />Im folgenden lauscht varnish auf Port 80 des Servers. Die Daten werden zudem unter /data/varnish/$INSTANCE/ in einer 1GB großen *.bin Datei abgelegt.

Nach der Aktivierung, wie auf beiden Screenshots klar zu erkennen, werden weniger Apache Instanzen gestartet, das meiste wird von varnish abgearbeitet. Zudem kommt es auch dazu, dass RAM freigegeben wird, wie auf dem ersten Screenshot gut zu sehen ist. Ein überragendes Ergebnis, wenn man bedenkt, dass das System zuvor zum Teil über wenige und in Stoßzeiten keine freien Ressourcen mehr hatte.
<h3>3.3) Apache Logging anpassen</h3>
<br />Oftmals verwendet man Tools wie AWStats um Logfiles des Webservers auswerten zu können. Verändert man jedoch nicht die Methode des Loggings, so meldet sich jede Anfrage nur noch mit der IP von Varnish. Abhilfe schafft folgende Einstellung im jeweiligen vHost der Domains.
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">LogFormat <span style="color: #ff0000;">&quot;%{X-Forwarded-For}i %l %u %t <span style="color: #000099; font-weight: bold;">\&quot;</span>%r<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">%&gt;s %b <span style="color: #000099; font-weight: bold;">\&quot;</span>%{Referer}i<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>%{User-Agent}i<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> varnishcombined</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CustomLog <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>www.domain.tld-access.log varnishcombined</div></li></ol></pre></div></div><br /><br />Damit werden weitergeleitete Anfragen ebenfalls in Logs festgehalten.<br /><br />
<h2>4) Fazit</h2>
Bei unseren Tests konnten wir Auslieferungszeiten drastisch vermindern und dazu die Systemlast ebenfalls konstant auf einem Minimum halten. Wo sonst ein Webserver trotz Cachings ausstieg, konnte varnish klar und deutlich punkten und noch dazu einen reibungslosen Betrieb garantieren. (fr)]]></content:encoded>
			<category>Tuning</category>
			
			
			<pubDate>Wed, 04 May 2011 16:20:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>GET Parameter auf Proxy weiterleiten </title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/get-parameter-auf-proxy-weiterleiten.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/get-parameter-auf-proxy-weiterleiten.html</guid>
			<description>GET Variablen an eine über Reverse-Proxy aufgerufene URL anhängen</description>
			<content:encoded><![CDATA[Wenn über einen Reverse Proxy eine URL mit angehängten GET Variablen aufgerufen werden soll wird man auf einige Probleme stoßen.
Das Proxy-Modul von Apache kann das Fragezeichen zum Beginn der GET Parameters nicht verarbeiten.
<h2>mod-Proxy zerstört Fragezeichen in URL</h2>
Die URL htlp://www.domain.tld soll über Proxy aufgerufen werden und folgender GET Parameter angehängt werden:
?id=test
<br />Die aufgerufene URL soll letztendlich so aussehen: 
htlp://www.domain.tld/?id=test
Wenn diese in der ReverseProxy-Direktive der VHost-Konfiguration wie folgt gesetzt ist, wird der Aufruf nicht funktionieren.
<div id="tx_codehighlight_pi1"><div class="code"><pre class="apache" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;<span style="color: #000000; font-weight:bold;">Location</span> /&gt;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #00007f;">ProxyPass</span>  htlp://www.domain.tld/?id=test/</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #00007f;">ProxyPassReverse</span>  htlp://www.domain.tld/</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;/<span style="color: #000000; font-weight:bold;">Location</span>&gt;</div></li></ol></pre></div></div>
Da das Proxy Modul, das Fragezeichen falsch interpretiert und in ein %3F umwandelt, wird am Zielserver die URL so dargestellt:
&quot;GET /%3Fid=test HTTP/1.1&quot; 403 335 &quot;
<h2>Rewrite-Modul mit Proxy kombinieren</h2>
Damit am Zielserver der GET Parameter korrekt&nbsp; der URL angehängt werden kann ist Eintrag Rewrite Regel in der VHost-Konfiguration notwendig:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="apache" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;<span style="color: #000000; font-weight:bold;">Proxy</span> *&gt;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #00007f;">RewriteRule</span> \/$ /?id=test [L,NE]</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;/<span style="color: #000000; font-weight:bold;">Proxy</span>&gt;</div></li></ol></pre></div></div>
Diese Regel haben wir auf mehreren Domainkonfigurationen im Einsatz und ist zum Beispiel sehr hilfreich, wenn von einer Domain A auf die Domain B weitergeleitet wird, jedoch bestimmte GET Parameter angehängt werden sollen. (ch)
]]></content:encoded>
			<category>Verschiedenes</category>
			
			
			<pubDate>Wed, 16 Mar 2011 16:03:00 +0100</pubDate>
			
		</item>
		
		<item>
			<title>PHP OP-Code Caching Programme im Vergleich </title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/php-op-code-caching-programme-im-vergleich.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/php-op-code-caching-programme-im-vergleich.html</guid>
			<description>PHP tuning durch eAccelerator, xCache, apc unter Ubuntu 10.04 und PHP5.3</description>
			<content:encoded><![CDATA[PHP hat als Scriptsprache einen entscheidenden Performance-Nachteil. Der Programmcode liegt zu der Zeit in der er vom System ausgeführt wird in einer für Menschen lesbaren, aber unnötig umfangreichen Form vor. Diesen Text muss der Interpreter erst einlesen und in Maschinenlesbare Form umwandeln.
Diesen Prozess können Caching-Programme umgehen, indem sie den generierten Maschinencode speichern. Wird ein Script nochmals ausgeführt, kann die Übersetzung des Scriptes wegfallen.
Die drei wichtigsten Vertreter unter den Op-Code-Caching Programmen sind eAccelerator, APC und xCache. Proprietäre Lösungen wie die Zend-Programme haben wir hier nicht berücksichtigt.
Unter Ubuntu 10.04 sind die Programme&nbsp;php-apc und php5-xcache bereits in den Paketquellen vorhanden. Ein einfaches apt-get install und ein anschließender Neustart des Webservers reichen zur Installation aus.
Der eAccelerator hingegen muss von der Seite http://eaccelerator.net/ im Quellcode heruntergeladen werden. Die Anleitung dort erklärt die einfache Installation aber gut. Wenn man unter php die Option OpenBasedir benutzt sollte man unbedingt die Option --without-eaccelerator-use-inode beim Kompilieren mitgeben.&nbsp;
Alle drei Programme können den Seitenaufbau einer komplexen PHP-Webseite (in unserem Beispiel TYPO3 4.5) mehr als verdoppeln.
Da alle Programme die gleiche Funktion haben, überrascht es wenig, dass die Ergebisse untereinander wenig unterschiedlich sind. Auch die Versuche in den Konfigurationsdateien mehr Geschwindigkeit herauszukitzeln haben keine messbaren Gewinne gebracht.
Unser System (Intel XEON X3220&nbsp; @ 2.40GHz mit 8 GB RAM) schaff: 
<table><caption>PHP-Caching im Vergleich</caption><thead><tr><th scope="col" rowspan="1">Cache</th><th scope="col" rowspan="1">Anfragen pro Sekunde</th></tr></thead><tbody><tr><td>ohne</td><td> 20.38</td></tr><tr><td>eaccelerator</td><td>39.15</td></tr><tr><td>apc</td><td>39.32</td></tr><tr><td>xcache</td><td>38.88</td></tr></tbody></table>

<span style="font-weight: bold;">Fazit:</span>
APC wird voraussichtlich in der kommenden Version PHP6 im Core von PHP enthalten sein. xCache wird vom lighthttp-Projekt betreut. Beide sollten daher gut gepflegt werden. Welcher zum Einsatz kommt ist mehr eine Frage des persönlichen Geschmacks.
Unter Ubuntu 8.04 haben wir mit der altern xCache-Version aus den Programmpaketen Probleme mit einzelnen TYPO3-Installationen beobachtet. <br />Auf älteren Systemen mit Ubuntu 8.04 setzten wir daher weiterhin auf den eAccelerator. <br />(te)]]></content:encoded>
			<category>Tuning</category>
			
			
			<pubDate>Fri, 11 Mar 2011 12:00:00 +0100</pubDate>
			
		</item>
		
		<item>
			<title>Reaktion auf DDoS Angriffe</title>
			<link>http://foobar.lamp-solutions.de/howtos/sicherheit/einzelansicht-sicherheit/artikel/reaktion-auf-ddos-angriffe.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/sicherheit/einzelansicht-sicherheit/artikel/reaktion-auf-ddos-angriffe.html</guid>
			<description>Möglicher Lösungsweg zur Abwehr von DDoS Attacken</description>
			<content:encoded><![CDATA[Sogenannte <link http://de.wikipedia.org/wiki/Denial_of_Service _blank external-link-new-window "Öffnet externen Link in neuem Fenster">Distributed Denial of Service Angriffe</link> werden in der Regel verteilt von mehreren Standorten aus geführt. Bei diesen Angriffen werden Serverdienste mit einer Vielzahl von Anfragen überlastet, so dass diese bei gewöhnlichen Anfragen gar nicht mehr oder langsam reagieren.<br /><br />
<h2>Lösungswege</h2>
Wie kann man aber solche Angriffe abwehren? Für beide Seiten ist es immer eine Frage der zur Verfügung stehenden Ressourcen. So bringen die besten Abwehrtechniken nichts, wenn der Angreifer mehr Möglichkeiten und Ressourcen besitzt.
<h3>Erkennung von Mustern</h3>
Bei dem Angriff auf den Webserverdienst einer unserer Kundenserver konnten wir die Erfahrung machen, dass in den Apache-Logfiles die angreifenden IPs nach einer gewissen Struktur erkennbar waren. Die entsprechenden Anfragen besaßen zum Beispiel keinerlei Browser- oder Betriebssystemkennung.
Nach diesem Muster konnten knapp 1000 IP-Adressen herausgefiltert und die davon gesendeten Anfragen serverseitig verworfen werden.
Dazu haben wir folgendes kleine Skript geschrieben: 
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">IPBLACKLIST</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>ipblacklist.txt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'&quot;-&quot; &quot;-&quot;'</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>www.domain-des-kunden.net-access.log \</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;-&quot;</span> -f1<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #000000; font-weight: bold;">do</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #007800;">$i</span> <span style="color: #007800;">$IPBLACKLIST</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$IPBLACKLIST</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> eth0 <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-s</span> <span style="color: #007800;">$i</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-j</span> DROP</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">echo</span> blacklisting:<span style="color: #007800;">$i</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">done</span></div></li></ol></pre></div></div>
<h3>Anzahl der Anfragen analysieren</h3>
Im vorhergehenden Beispiel wurden die Angriffe speziell auf den Webserver geführt. Doch wie fängt man Angriffe ab, die mehrere Serverdienste betreffen?
Auch hier führen wir die Lösung von vorhin weiter. Hier werten wir aber nicht die Logfile aus, sondern analysieren die Anzahl der eingehenden Anfragen pro IP-Adresse aus.
Wenn also mehr als 15 gleichzeitige Verbindungen pro IP stattfinden, ist die Wahrscheinlichkeit sehr hoch, dass sich hier um einen Angriff handelt, daraufhin wir die entsprechende IP in eine Blacklist geschrieben.
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">IPBLACKLIST</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>ipblacklist.txt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">LOGFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>www.domain-des-kunden.de<span style="color: #000000; font-weight: bold;">/</span>ipblacklist.log</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">WHITELIST</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>whitelist.txt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> blacklist <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">netstat</span> <span style="color: #660033;">-tuna</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> :<span style="color: #007800;">$PORT</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> SYN_RECV <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span><span style="color: #ff0000;">' '</span> <span style="color: #ff0000;">'{ print $5}'</span> \</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span><span style="color: #ff0000;">':'</span> <span style="color: #ff0000;">'{ print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #000000; font-weight: bold;">do</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #007800;">anzahl</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">netstat</span> <span style="color: #660033;">-tuna</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> :<span style="color: #007800;">$PORT</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> SYN_RECV <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -l<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span>:<span style="color: #007800;">$PORT</span>:<span style="color: #007800;">$anzahl</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$anzahl</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">15</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #007800;">$i</span> <span style="color: #007800;">$WHITELIST</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #007800;">$i</span> <span style="color: #007800;">$IPBLACKLIST</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$IPBLACKLIST</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #ff0000;">&quot;;&quot;</span><span style="color: #007800;">$i</span><span style="color: #ff0000;">&quot;;&quot;</span><span style="color: #007800;">$PORT</span><span style="color: #ff0000;">&quot;;&quot;</span><span style="color: #007800;">$anzahl</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> eth0 <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-s</span> <span style="color: #007800;">$i</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-j</span> DROP</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> eth0 <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-s</span> <span style="color: #007800;">$i</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">443</span> <span style="color: #660033;">-j</span> DROP</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> eth0 <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-s</span> <span style="color: #007800;">$i</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">22</span> <span style="color: #660033;">-j</span> DROP</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> eth0 <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-s</span> <span style="color: #007800;">$i</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">25</span> <span style="color: #660033;">-j</span> DROP</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                    <span style="color: #7a0874; font-weight: bold;">echo</span> blacklisting:<span style="color: #007800;">$i</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">done</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#Webserver</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">PORT</span>=<span style="color: #000000;">80</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">blacklist</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#ssh</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">PORT</span>=<span style="color: #000000;">22</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">blacklist</div></li></ol></pre></div></div>
Über Cron wird das Skript einmal in der Minute aufgerufen. Auf diese  Weise konnten mehrere hundert IP-Adressen gesperrt werden bzw. deren  ankommenden Pakete verworfen werden.<br /><br />
<h2>Fazit</h2>
In beiden Fällen wurde nach kurzer Zeit das gewünschte Ergebnis erzielt. Die Angriffe sind stetig zurückgegangen und das Kontingent an IP-Adressen was dem Angreifer zur Verfügung stand war nach wenigen Stunden erschöpft. (ch)]]></content:encoded>
			<category><a href="howtos/lamp-administration/sicherheit.html" title="Sicherheit">Sicherheit</a></category>
			
			
			<pubDate>Tue, 08 Mar 2011 10:07:00 +0100</pubDate>
			
		</item>
		
	</channel>
</rss>
