当前位置: > Linux集群 > 负载均衡SLB >

dns轮询负载均衡常见问题

时间:2014-05-13 18:29来源:linux.it.net.cn 作者:it

ttl设置小些有利于轮训的效果如TTL=600
一个dns问题,如何一个域名解析成多个IP

dns轮询 多写几个主机记录就可以了
www IN A xxx.xxx.xxx.1
www IN A xxx.xxx.xxx.2
www IN A xxx.xxx.xxx.3
..............
dns轮询不能判断网络状况
如果想判断网络状况可以用四层交换机等设备来实现
DNS 的 round-robin 在某一程度上,可以將不同的 session 分配到不同的 IP 上
1:一个ip对多个域名:例如:一台机器上跑多个站点;
2:多个ip对一个域名:例如:dns的负载均衡配置

这是我在BIND-9.4 的管理员手册找的,请参考

Load Balancing

A primitive form of load balancing can be achieved in the DNS by using multiple A records for one
name.
For example, if you have three WWW servers with network addresses of 10.0.0.1, 10.0.0.2 and 10.0.0.3,
a set of records such as the following means that clients will connect to each machine one third of the
time:
Name   TTL   CLASS   TYPE   Resource Record (RR) Data
www   600    IN           A      10.0.0.1
           600    IN           A      10.0.0.2
           600    IN           A      10.0.0.3
When a resolver queries for these records, BIND will rotate them and respond to the query with the
records in a different order. In the example above, clients will randomly receive records in the order 1,
2, 3; 2, 3, 1; and 3, 1, 2. Most clients will use the first record returned and discard the rest.
For more detail on ordering responses, check the rrset-order substatement in the options statement, see
RRset Ordering.

Linux下如何清除DNS cache
#rndc --help
rndc: illegal option -- -
Usage: rndc [-c config] [-s server] [-p port]
        [-k key-file ] [-y key] [-V] command

command is one of the following:

reload        Reload configuration file and zones.
reload zone [class [view]]
                Reload a single zone.
refresh zone [class [view]]
                Schedule immediate maintenance for a zone.
retransfer zone [class [view]]
                Retransfer a single zone without checking serial number.
freeze zone [class [view]]
                Suspend updates to a dynamic zone.
thaw zone [class [view]]
                Enable updates to a frozen dynamic zone and reload it.
reconfig      Reload configuration file and new zones only.
stats         Write server statistics to the statistics file.
querylog      Toggle query logging.
dumpdb [-all|-cache|-zones] [view ...]
                Dump cache(s) to the dump file (named_dump.db).
stop          Save pending updates to master files and stop the server.
stop -p       Save pending updates to master files and stop the server
                reporting process id.
halt          Stop the server without saving pending updates.
halt -p       Stop the server without saving pending updates reporting
                process id.
trace         Increment debugging level by one.
trace level   Change the debugging level.
notrace       Set debugging level to 0.
flush         Flushes all of the server's caches.
flush [view] Flushes the server's cache for a view.
flushname name [view]
                Flush the given name from the server's cache(s)
status        Display status of the server.
recursing     Dump the queries that are currently recursing (named.recursing)
*restart      Restart the server.

linux as 4的dns轮询如何设置,缓存时间又在那里设置?
$TTL        600         ; 这个是DNS的清除CACHE的时间,大小的设定要根据自己的要求设置

@         IN         SOA          localhost.        root.localhost. (
                         20060101           ;serial       这个是master与slave 的同步有关
                 28800                 ; refresh   定义出slave多久主动去检查master的serial值
                         14400                 ;retry        定义如果salve没有连上master dns主机后多久重试
                         72000                ;expire       定义如果到这个值后,salve仍然没有连上master dns主机,则放弃连接!
                         86400 )             ;minimum 这个是定义ttl值,如果没有定义ttl则会默认取这个值!

使用dig @根域名服务器地址即可。获得最新的根域服务器列表即named.ca或named.root的最新文件

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容