0

i have two webservers and the next zone

web1.example.org IN A 10.0.0.1
web2.example.org IN A 10.0.0.2

example.org IN CNAME web1.example.org
example.org IN CNAME web2.example.org

The problem its the php session, you go to web1.example.org and later the dns responds web2.example.org.

How can i fix this?

1
  • 1
    I'm probably being anal-retentive, and this doesn't have anything to do with your issue, but you can't have a CNAME as the root of a domain. RFC 1034 specifies that a CNAME can't be shared with any RR having the same name, including NS records. Dec 16, 2010 at 3:36

2 Answers 2

5

You either need a persistent session store that's not on either server's local disk (e.g. a database or a network volume) or you need to ditch the round-robin approach and implement a load balancer intelligent enough to keep sending each client to the same server in the cluster.

Round-robin is a bad idea for availability anyway -- if one server fails, you're redirecting half of your traffic to a dead system.

2
  • Round robin balancing to a pair of load-balancers is slightly less bad, though. Dec 16, 2010 at 10:20
  • That's yet another point of failure -- you want to at least make sure the IPs are either multicast or high-availability vIPs. Dec 16, 2010 at 14:03
0

If you do not want the load to be evenly spread across your servers I would suggest configuring the TTL based on your users sessions to ensure that connections will most likely stay pointed at any given web server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .