From 19b535dff4c81ed6bd54ab2daa7a572dbce32495 Mon Sep 17 00:00:00 2001 From: Rich Bowen Date: Thu, 5 Nov 2009 01:55:25 +0000 Subject: [PATCH] Moves the 'sharding' rule into the 'advanced' doc. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832971 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/rewrite/advanced.html.en | 59 +++++++++++++++++++++++++++- docs/manual/rewrite/advanced.xml | 56 ++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 1 deletion(-) diff --git a/docs/manual/rewrite/advanced.html.en b/docs/manual/rewrite/advanced.html.en index 91c7c2d571..0ca151d715 100644 --- a/docs/manual/rewrite/advanced.html.en +++ b/docs/manual/rewrite/advanced.html.en @@ -33,7 +33,64 @@ configuration.

See also

- +
top
+
+

URL-based sharding accross multiple backends

+ + + +
+
Description:
+ +
+

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.

+
+ +
Solution:
+ +
+

A mapping is maintained, from users to target servers, in + external map files. They look like:

+ +
+user1  physical_host_of_user1
+user2  physical_host_of_user2
+:      :
+
+ +

We put this into a map.users-to-hosts file. The + aim is to map;

+ +
+/u/user1/anypath
+
+ +

to

+ +
+http://physical_host_of_user1/u/user/anypath
+
+ +

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):

+ +
+RewriteEngine on
+
+RewriteMap      users-to-hosts   txt:/path/to/map.users-to-hosts
+
+RewriteRule   ^/u/([^/]+)/?(.*)   http://${users-to-hosts:$1|server0}/u/$1/$2
+
+
+
+ +

Available Languages:  en