:param values: table of weight, string (such as IPv4 or IPv6 address).
This allows basic persistent load balancing across a number of backends. It means that
- test.example.com will always resolve to the same IP, but test2.example.com may go elsewhere.
+ test.mydomain.example.com will always resolve to the same IP, but test2.mydomain.example.com
+ may go elsewhere. This function is only useful for wildcard records.
This works similar to round-robin load balancing, but has the advantage of making traffic
for the same domain always end up on the same server which can help cache hit rates.
An example::
- mydomain.example.com IN LUA A ("picknamehashed({ "
+ *.mydomain.example.com IN LUA A ("picknamehashed({ "
" {15, "192.0.2.1"}, "
" {100, "198.51.100.5"} "
"}) ")
queries = [
{
+ 'query': dns.message.make_query('test.namehashed.example.org', 'A'),
'expected': dns.rrset.from_text('test.namehashed.example.org.', 0,
dns.rdataclass.IN, 'A',
'1.2.3.4'),
- 'query': dns.message.make_query('test.namehashed.example.org', 'A')
},
{
+ 'query': dns.message.make_query('test2.namehashed.example.org', 'A'),
'expected': dns.rrset.from_text('test2.namehashed.example.org.', 0,
dns.rdataclass.IN, 'A',
'4.3.2.1'),
- 'query': dns.message.make_query('test2.namehashed.example.org', 'A')
}
]
for query in queries :