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 220.127.116.11) - (eth0 18.104.22.168) nuvola (eth1 22.214.171.124) -
internet - (eth0 126.96.36.199) yoda
nuvola> iptables -A FORWARD -i eth0 -o eth1 -s 188.8.131.52 -j ACCEPT
nuvola> iptables -t nat -A POSTROUTING -s 184.108.40.206 -j SNAT --to 220.127.116.11
#this rules nat pc desktop for Internet
nuvola> iptables -A INPUT -s 18.104.22.168 -p tcp --dport 80 -j ACCEPT
#this enables the web services for yoda
yoda> iptables -t nat -A PREROUTING -s 22.214.171.124 -d 126.96.36.199 -p tcp --dport
80 -j DNAT --to 188.8.131.52
yoda> iptables -A FORWARD -s 184.108.40.206 -d 220.127.116.11 -j ACCEPT
#this enables yoda to redirect the http request
yoda> iptables -t nat -A POSTROUTING -s 18.104.22.168 -d 22.214.171.124 -p tcp
--dport 80 -j SNAT --to 126.96.36.199
#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://188.8.131.52/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 184.108.40.206 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