About to set up a lab environment with HAproxy for test purposes. HAproxy will load-balance (round robin) two web servers (Apache), running two virtual hosts on each server. Site A will be hosted on both server 1 and server 2 and the same for Site B.
My question regards the DNS configuration.
Can I create an A record for the load balancer, and one CNAME record for each website and point them to the load balancers? Assuming that the virtual hosts servernames are the same on both servers.
Or do I need to create two subdomains with two A records in each subdomain. The A records will point Site A and B to one of the two web servers in each subdomain. Example below.
Example A SiteA.server1.domain.local A SiteB.server1.domain.local
A SiteA.server2.domain.local A SiteB.server2.domain.local
Then create an A record in the parent domain for the load balancer, and two CNAME records pointing one of the Site A & B to the load balancer.
Which would work?
www) even if your example is not clear/poorly formatted (it doesn't show anyArecords - with IP addresses - and please remember about IPv6 ! - norCNAMErecords). Also your question may be offtopic as too broad/vague and not really in a business kind of setup. Separately, what prohibits you from testing the 2 hypothesis and just see which one gives you the better outcomes based on your constraints?