]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Moves the 'sharding' rule into the 'advanced' doc.
authorRich Bowen <rbowen@apache.org>
Thu, 5 Nov 2009 01:55:25 +0000 (01:55 +0000)
committerRich Bowen <rbowen@apache.org>
Thu, 5 Nov 2009 01:55:25 +0000 (01:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832971 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/rewrite/advanced.html.en
docs/manual/rewrite/advanced.xml

index 91c7c2d57101864c8f2d04409550c65b869b0313..0ca151d715d628a73eba191d581048c4e0de7292 100644 (file)
@@ -33,7 +33,64 @@ configuration.</div>
 
 </div>
 <div id="quickview"><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li></ul></div>
-</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="sharding" id="sharding">URL-based sharding accross multiple backends</a></h2>
+
+  
+
+  <dl>
+    <dt>Description:</dt>
+
+    <dd>
+      <p>A common technique for distributing the burden of 
+      server load or storage space is called "sharding". 
+      When using this method, a front-end server will use the
+      url to consistently "shard" users or objects to separate
+      backend servers.</p>
+    </dd>
+
+    <dt>Solution:</dt>
+
+    <dd>
+      <p>A mapping is maintained, from users to target servers, in
+      external map files. They look like:</p>
+
+<div class="example"><pre>
+user1  physical_host_of_user1
+user2  physical_host_of_user2
+:      :
+</pre></div>
+
+  <p>We put this into a <code>map.users-to-hosts</code> file. The
+    aim is to map;</p>
+
+<div class="example"><pre>
+/u/user1/anypath
+</pre></div>
+
+  <p>to</p>
+
+<div class="example"><pre>
+http://physical_host_of_user1/u/user/anypath
+</pre></div>
+
+      <p>thus every URL path need not be valid on every backend physical
+      host. The following ruleset does this for us with the help of the map
+      files assuming that server0 is a default server which will be used if
+      a user has no entry in the map):</p>
+
+<div class="example"><pre>
+RewriteEngine on
+
+RewriteMap      users-to-hosts   txt:/path/to/map.users-to-hosts
+
+RewriteRule   ^/u/<strong>([^/]+)</strong>/?(.*)   http://<strong>${users-to-hosts:$1|server0}</strong>/u/$1/$2
+</pre></div>
+    </dd>
+  </dl>
+
+</div></div>
 <div class="bottomlang">
 <p><span>Available Languages: </span><a href="../en/rewrite/avoid.html" title="English">&nbsp;en&nbsp;</a></p>
 </div><div id="footer">
index 86db00018e472a695f351d0e71ca9c43c394295b..21675a0816d16a0797f3e7a641e46c77a082de05 100644 (file)
@@ -40,5 +40,61 @@ configuration.</note>
 <seealso><a href="../mod/mod_rewrite.html">Module documentation</a></seealso>
 <seealso><a href="intro.html">mod_rewrite introduction</a></seealso>
 
+<section id="sharding">
+
+  <title>URL-based sharding accross multiple backends</title>
+
+  <dl>
+    <dt>Description:</dt>
+
+    <dd>
+      <p>A common technique for distributing the burden of 
+      server load or storage space is called "sharding". 
+      When using this method, a front-end server will use the
+      url to consistently "shard" users or objects to separate
+      backend servers.</p>
+    </dd>
+
+    <dt>Solution:</dt>
+
+    <dd>
+      <p>A mapping is maintained, from users to target servers, in
+      external map files. They look like:</p>
+
+<example><pre>
+user1  physical_host_of_user1
+user2  physical_host_of_user2
+:      :
+</pre></example>
+
+  <p>We put this into a <code>map.users-to-hosts</code> file. The
+    aim is to map;</p>
+
+<example><pre>
+/u/user1/anypath
+</pre></example>
+
+  <p>to</p>
+
+<example><pre>
+http://physical_host_of_user1/u/user/anypath
+</pre></example>
+
+      <p>thus every URL path need not be valid on every backend physical
+      host. The following ruleset does this for us with the help of the map
+      files assuming that server0 is a default server which will be used if
+      a user has no entry in the map):</p>
+
+<example><pre>
+RewriteEngine on
+
+RewriteMap      users-to-hosts   txt:/path/to/map.users-to-hosts
+
+RewriteRule   ^/u/<strong>([^/]+)</strong>/?(.*)   http://<strong>${users-to-hosts:$1|server0}</strong>/u/$1/$2
+</pre></example>
+    </dd>
+  </dl>
+
+</section>
 
 </manualpage>