Re: web replication
- From: fusillo <fusillo@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 17 Aug 2006 06:57:11 +0200
fusillo ha scritto:
ed ha scritto:
to enable the http session information i think about using a network
filesystem placed on backend and setting the mount point as a session
directory path (using the php session's configuration directive)
the cookies should not be a problem, should it?
Session cookies relate to memory in the server, so if it's a session
cookie, then yes it's a problem if one cannot be certain of which box
the client is going to connect to in 5 mins time.
yes but it's this the reason to use a shared memory for the session
information. Get it by mounting the same nfs (placed phisically in the
backend) in the path used to save the session dictionary in every single
cookies resides in the client browser and forwarded to the server
based on domain name (the bilancer domain name).
to replicate the db i would use a simple master slave mysql
This depends on your balancing device, some are full protocol proxies
which can do exactly as you ask. I think there's one called 'pound'
which is GNU that can do this for you.
i wouldn't play with layer 7, my idea is using a layer 4 load bilancing
, i'm actually studying the lvs documentation, ipvs via nat use nat to
traslate the virtual service ip(the ip of the web bilancer) to one real
server ip, choosing the server by means of a given scheduling algoritm.
if the cookie's domain matches the virtual service ip when a browser
send it in a http header it will be forwarded and bilanced to the real
server thanks a lvs nat rule, it shouldn't be important what server
because the session information is shared by the servers.
could it run?
i tested it playing with iptables using 2 host. nuvola is the web server
and nat for my pc desktop. yoda play as a fake balancer (in this example
it only redirects and forwawds to nuvola the http requests)
pc desktop (eth0 18.104.22.168) - (eth0 22.214.171.124) nuvola (eth1 126.96.36.199) -
internet - (eth0 188.8.131.52) yoda
nuvola> iptables -A FORWARD -i eth0 -o eth1 -s 184.108.40.206 -j ACCEPT
nuvola> iptables -t nat -A POSTROUTING -s 220.127.116.11 -j SNAT --to 18.104.22.168
#this rules nat pc desktop for Internet
nuvola> iptables -A INPUT -s 22.214.171.124 -p tcp --dport 80 -j ACCEPT
#this enables the web services for yoda
yoda> iptables -t nat -A PREROUTING -s 126.96.36.199 -d 188.8.131.52 -p tcp --dport
80 -j DNAT --to 184.108.40.206
yoda> iptables -A FORWARD -s 220.127.116.11 -d 18.104.22.168 -j ACCEPT
#this enables yoda to redirect the http request
yoda> iptables -t nat -A POSTROUTING -s 22.214.171.124 -d 126.96.36.199 -p tcp
--dport 80 -j SNAT --to 188.8.131.52
#this is becouse my desktop pc is natted by nuvola and i don't want
another pc for this game.
when the browser sends a request for url http://184.108.40.206/mysite, after
the packet's boomarang trip nuvola sends the session id in the http
header to the browser
(i've used the default value for the domain and path for the session's
Checking the cookie values saved in pc desktop the domain is 220.127.116.11 and
path is /, this is funny becouse the Netscape's cookie reference states:
The default value of domain is the host name of the server which
generated the cookie response.
hower this enables the cookie in load balancing envirament based on nat