From: Colm MacCarthaigh Date: Tue, 3 Nov 2009 02:02:23 +0000 (+0000) Subject: Rewrite the "cluster" section of the rewrite docs. Changes; X-Git-Tag: 2.3.3~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72ed570c2efa2ef77275cfb4cd5a45dc29a71fd7;p=thirdparty%2Fapache%2Fhttpd.git Rewrite the "cluster" section of the rewrite docs. Changes; * Call the technique "sharding" - like the rest of the world does. * Simplify to just one example use-case, sharding users. * Make the usage of the term "physical host" consistent. * Remove unreachable nonsense rewrite rules * Remove redundant sentences. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832261 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/rewrite/rewrite_guide.xml b/docs/manual/rewrite/rewrite_guide.xml index 346851587bc..ddac4b86cea 100644 --- a/docs/manual/rewrite/rewrite_guide.xml +++ b/docs/manual/rewrite/rewrite_guide.xml @@ -488,73 +488,55 @@ while (<>) {
- Web Cluster with Consistent URL Space + URL-based sharding accross multiple backends
Description:
-

We want to create a homogeneous and consistent URL - layout across all WWW servers on an Intranet web cluster, i.e., - all URLs (by definition server-local and thus - server-dependent!) become server independent! - What we want is to give the WWW namespace a single consistent - layout: no URL should refer to - any particular target server. The cluster itself - should connect users automatically to a physical target - host as needed, invisibly.

+

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 seperate + backend servers.

Solution:
-

First, the knowledge of the target servers comes from - (distributed) external maps which contain information on - where our users, groups, and entities reside. They have the - form:

+

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

-user1  server_of_user1
-user2  server_of_user2
+user1  physical_host_of_user1
+user2  physical_host_of_user2
 :      :
 
-

We put them into files map.xxx-to-host. - Second we need to instruct all servers to redirect URLs - of the forms:

+

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

-/u/user/anypath
-/g/group/anypath
-/e/entity/anypath
+/u/user1/anypath
 

to

-http://physical-host/u/user/anypath
-http://physical-host/g/group/anypath
-http://physical-host/e/entity/anypath
+http://physical_host_of_user1/u/user/anypath
 
-

when any URL path need not be valid on every server. 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):

+

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      user-to-host   txt:/path/to/map.user-to-host
-RewriteMap     group-to-host   txt:/path/to/map.group-to-host
-RewriteMap    entity-to-host   txt:/path/to/map.entity-to-host
+RewriteMap      users-to-hosts   txt:/path/to/map.users-to-hosts
 
-RewriteRule   ^/u/([^/]+)/?(.*)   http://${user-to-host:$1|server0}/u/$1/$2
-RewriteRule   ^/g/([^/]+)/?(.*)  http://${group-to-host:$1|server0}/g/$1/$2
-RewriteRule   ^/e/([^/]+)/?(.*) http://${entity-to-host:$1|server0}/e/$1/$2
-
-RewriteRule   ^/([uge])/([^/]+)/?$          /$1/$2/.www/
-RewriteRule   ^/([uge])/([^/]+)/([^.]+.+)   /$1/$2/.www/$3\
+RewriteRule   ^/u/([^/]+)/?(.*)   http://${users-to-hosts:$1|server0}/u/$1/$2