在Linux下搭建HA和LB集群(LVS&Heartbeat群集)
在linux下搭建HA和LB集群(lvs&heartbeat群集)
案例应用拓扑图:
案例应用实现详细步骤如下:
一.DNS服务器配置
1.1 在real-server-1上的DNS服务器配置:
[root@server1 ~]# yum install bind bind-chroot caching-nameserver –y
[root@server1 ~]# cd /var/named/chroot/etc/
[root@server1 etc]# cp -p named.caching-nameserver.conf named.conf
[root@server1 etc]# vim named.conf
15 listen-on port 53 { any; };
27 allow-query { any; };
28 allow-query-cache { any; };
37 match-clients { any; };
38 match-destinations { any; };
[root@server1 etc]# vim named.rfc1912.zones
20 zone "japan.com" IN {
21 type master;
22 file "japan.com.db";
23 allow-update { none; };
24 };
37 zone "2.168.192.in-addr.arpa" IN {
38 type master;
39 file "192.168.2.db";
40 allow-update { none; };
41 };
[root@server1 etc]# cd ../var/named/
[root@server1 named]# cp -p localhost.zone japan.com.db
[root@server1 named]# cp -p named.local 192.168.2.db
[root@server1 named]# vim japan.com.db
1 $TTL 86400
2 @ IN SOA ns.japan.com. root (
3 43 ; serial (d. adams )
4 3H ; refresh
5 15M ; retry
6 1W ; expiry
7 1D ) ; minimum
8
9 @ IN NS ns.japan.com.
10 ns IN A 192.168.2.131
11 www IN A 192.168.2.133
12 director1 IN A 192.168.2.134
13 director2 IN A 192.168.2.135
[root@server1 named]# vim 192.168.2.db
1 $TTL 86400
2 @ IN SOA localhost. root.localhost. (
3 1997022700 ; Serial
4 28800 ; Refresh
5 14400 ; Retry
6 3600000 ; Expire
7 86400 ) ; Minimum
8 IN NS localhost.
9 133 IN PTR www.japan.com.
10 134 IN PTR director1.japan.com.
11 135 IN PTR director2.japan.com.
[root@server1 named]# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@server1 named]# rndc reload
server reload successful
1.2 在real-server-2上的DNS服务器配置:
[root@server2 ~]# yum install bind bind-chroot caching-nameserver –y
[root@server2 ~]# cd /var/named/chroot/etc/
[root@server2 etc]# cp -p named.caching-nameserver.conf named.conf
[root@server2 etc]# vim named.conf
15 listen-on port 53 { any; };
27 allow-query { any; };
28 allow-query-cache { any; };
37 match-clients { any; };
38 match-destinations { any; };
[root@server2 etc]# vim named.rfc1912.zones
20 zone "japan.com" IN {
21 type master;
22 file "japan.com.db";
23 allow-update { none; };
24 };
37 zone "2.168.192.in-addr.arpa" IN {
38 type master;
39 file "192.168.2.db";
40 allow-update { none; };
41 };
[root@server2 etc]# cd ../var/named/
[root@server2 named]# cp -p localhost.zone japan.com.db
[root@server2 named]# cp -p named.local 192.168.2.db
[root@server2 named]# vim japan.com.db
1 $TTL 86400
2 @ IN SOA ns.japan.com. root (
3 43 ; serial (d. adams )
4 3H ; refresh
5 15M ; retry
6 1W ; expiry
7 1D ) ; minimum
8
9 @ IN NS ns.japan.com.
10 ns IN A 192.168.2.131
11 www IN A 192.168.2.133
12 director1 IN A 192.168.2.134
13 director2 IN A 192.168.2.135
[root@server2 named]# vim 192.168.2.db
1 $TTL 86400
2 @ IN SOA localhost. root.localhost. (
3 1997022700 ; Serial
4 28800 ; Refresh
5 14400 ; Retry
6 3600000 ; Expire
7 86400 ) ; Minimum
8 IN NS localhost.
9 133 IN PTR www.japan.com.
10 134 IN PTR director1.japan.com.
11 135 IN PTR director2.japan.com.
[root@server2 named]# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@server2 named]# rndc reload
server reload successful