BIND 9
BIND 9
BIND 9
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
CHAPTER 3. 名字服务器配置 3.2. 负载均衡<br />
};<br />
allow-query { any; };<br />
// Do not provide recursive service<br />
recursion no;<br />
// Provide a reverse mapping for the loopback<br />
// address 127.0.0.1<br />
zone "0.0.127.in-addr.arpa" {<br />
type master;<br />
file "localhost.rev";<br />
notify no;<br />
};<br />
// We are the master server for example.com<br />
zone "example.com" {<br />
type master;<br />
file "example.com.db";<br />
// IP addresses of slave servers allowed to<br />
// transfer example.com<br />
allow-transfer {<br />
192.168.4.14;<br />
192.168.5.53;<br />
};<br />
};<br />
// We are a slave server for eng.example.com<br />
zone "eng.example.com" {<br />
type slave;<br />
file "eng.example.com.bk";<br />
// IP address of eng.example.com master server<br />
masters { 192.168.4.12; };<br />
};<br />
3.2 负载均衡<br />
使用DNS对一个名字配置多个记录(例如多个A记录)可以完成原始形式的负载均衡。<br />
例如,如果你有3 台WWW 服务器分别使用10.0.0.1,10.0.0.2和10.0.0.3 的网络地址,象以下这个记录<br />
集就意味着客户端将会分别对每台机器有三分之一的连接时间:<br />
Name TTL CLASS TYPE Resource Record (RR) Data<br />
www 600 IN A 10.0.0.1<br />
600 IN A 10.0.0.2<br />
600 IN A 10.0.0.3<br />
当一个解析器请求这些记录时,<strong>BIND</strong>将滚动这三个记录,以一个不同的顺序响应请求。在上面的例<br />
子中,不同的客户端将会随机收到以“1,2,3”;“2,3,1”和“3,1,2”的顺序的记录。大多<br />
数客户端将使用所得到的第一个记录而丢弃其余的。<br />
关于将响应排序的更详细的内容,检查options 语句的rrset-order子语句,参见资源记录集排序。<br />
16