RAC 11.2.0.3 SCAN IP 配置 二度衝擊

snowdba發表於2014-07-21
上一篇關於SCAN IP配置的文章受到環境限制,把DNS配置到了雙節點RAC的節點一上,這次我為DNS找了一個獨立的家,為其提供了一個獨立的伺服器,並且將SCAN IP配置了3個,和官方文件建議的一致。

步驟一,在DNS所在伺服器node3安裝DNS所需rpm包                                     
[root@node3 ~]# yum install bind bind-chroot caching-nameserver
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--&gt Running transaction check
---&gt Package bind.x86_64 30:9.3.6-16.P1.el5 set to be updated
---&gt Package bind-chroot.x86_64 30:9.3.6-16.P1.el5 set to be updated
---&gt Package caching-nameserver.x86_64 30:9.3.6-16.P1.el5 set to be updated
--&gt Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch        Version                    Repository
                                                                           Size
================================================================================
Installing:
 bind                    x86_64      30:9.3.6-16.P1.el5         ole5      988 k
 bind-chroot             x86_64      30:9.3.6-16.P1.el5         ole5       46 k
 caching-nameserver      x86_64      30:9.3.6-16.P1.el5         ole5       62 k

Transaction Summary
================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           502 MB/s | 1.1 MB     00:00    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : bind                                                     1/3
  Installing     : bind-chroot                                              2/3
  Installing     : caching-nameserver                                       3/3

Installed:
  bind.x86_64 30:9.3.6-16.P1.el5                                               
  bind-chroot.x86_64 30:9.3.6-16.P1.el5                                        
  caching-nameserver.x86_64 30:9.3.6-16.P1.el5                                 

Complete!

DNS伺服器IP地址為192.168.1.176
[root@node3 ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 08:00:27:9D:A2:9B 
          inet addr:192.168.1.176  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15517 (15.1 KiB)  TX bytes:5028 (4.9 KiB)

伺服器作業系統為OracleLinux5.7
[root@node3 ~]# cat /etc/issue
Oracle Linux Server release 5.7
Kernel \r on an \m

步驟二,配置name.conf檔案
[root@node3 ~]# cd /var/named/chroot/etc
[root@node3 etc]# ll
total 16
-rw-r--r-- 1 root root   405 Jul 21 10:23 localtime
-rw-r----- 1 root named 1230 Jan 14  2011 named.caching-nameserver.conf
-rw-r----- 1 root named  955 Jan 14  2011 named.rfc1912.zones
-rw-r----- 1 root named  113 Jul 21 10:40 rndc.key

利用複製amed.caching-nameserver.conf的方法來生成named.conf,注意引數-p 會保留組屬root named
[root@node3 etc]# cp -p named.caching-nameserver.conf named.conf
[root@node3 etc]# pwd
/var/named/chroot/etc

將127.0.0.1 改成 any
:%s/127.0.0.1/any/g

將 localhost 改成 any
:%s/localhost/any/g  
[root@node3 etc]# vi named.conf
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a any DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";

        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        allow-query     { any; };
        allow-query-cache { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view any_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

[root@node3 etc]# ll
total 20
-rw-r--r-- 1 root root   405 Jul 21 10:23 localtime
-rw-r----- 1 root named 1230 Jan 14  2011 named.caching-nameserver.conf
-rw-r----- 1 root named 1188 Jul 21 10:51 named.conf
-rw-r----- 1 root named  955 Jan 14  2011 named.rfc1912.zones
-rw-r----- 1 root named  113 Jul 21 10:40 rndc.key

步驟三, 建立域
[root@node1 etc]# vi /var/named/chroot/etc/named.rfc1912.zones
在檔案末尾追加下列資訊

zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "1.168.192.in-addr.arpa";
        allow-update { none; };
};
 

[root@node3 etc]# cd /var/named/chroot/var/named/
[root@node3 named]# ll
total 36
drwxrwx--- 2 named named 4096 Aug 26  2004 data
-rw-r----- 1 root  named  198 Jan 14  2011 localdomain.zone
-rw-r----- 1 root  named  195 Jan 14  2011 localhost.zone
-rw-r----- 1 root  named  427 Jan 14  2011 named.broadcast
-rw-r----- 1 root  named 1892 Jan 14  2011 named.ca
-rw-r----- 1 root  named  424 Jan 14  2011 named.ip6.local
-rw-r----- 1 root  named  426 Jan 14  2011 named.local
-rw-r----- 1 root  named  427 Jan 14  2011 named.zero
drwxrwx--- 2 named named 4096 Jul 27  2004 slaves

複製named.local來生成反向zone檔案
[root@node3 named]# cp -p named.local 1.168.192.in-addr.arpa
[root@node3 named]# ll
total 40
-rw-r----- 1 root  named  426 Jan 14  2011 1.168.192.in-addr.arpa
drwxrwx--- 2 named named 4096 Aug 26  2004 data
-rw-r----- 1 root  named  198 Jan 14  2011 localdomain.zone
-rw-r----- 1 root  named  195 Jan 14  2011 localhost.zone
-rw-r----- 1 root  named  427 Jan 14  2011 named.broadcast
-rw-r----- 1 root  named 1892 Jan 14  2011 named.ca
-rw-r----- 1 root  named  424 Jan 14  2011 named.ip6.local
-rw-r----- 1 root  named  426 Jan 14  2011 named.local
-rw-r----- 1 root  named  427 Jan 14  2011 named.zero
drwxrwx--- 2 named named 4096 Jul 27  2004 slaves

看看我們的scan ip在節點node1,node2的配置情況
#scan-ip
192.168.1.201   scan-cluster.localdomain        scan-cluster
192.168.1.202   scan-cluster.localdomain        scan-cluster
192.168.1.203   scan-cluster.localdomain        scan-cluster

向正向解析資料檔案localdoamin.zone新增3個SCAN IP
[root@node3 named]# vi localdomain.zone
$TTL    86400
@               IN SOA  localhost root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           localhost
localhost       IN A            127.0.0.1
scan-cluster    IN A            192.168.1.201
                       IN A            192.168.1.202
                       IN A            192.168.1.203


在反向解析資料檔案1.168.192.in-addr.arpa新增紫色字型部分
[root@node3 named]# vi 1.168.192.in-addr.arpa
$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      localhost.
1       IN      PTR     localhost.
201     IN      PTR     scan-cluster.localdomain.
202     IN      PTR     scan-cluster.localdomain.
203     IN      PTR     scan-cluster.localdomain.

步驟四,測試DNS伺服器解析SCAN IP
[root@node3 named]# /etc/init.d/named status
rndc: connect failed: 127.0.0.1#953: connection refused
named is stopped
[root@node3 named]#
[root@node3 named]# /etc/init.d/named start
Starting named:                                            [  OK  ]
[root@node3 named]# /etc/init.d/named status
number of zones: 7
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/1000
tcp clients: 0/100
server is up and running
named (pid  8423) is running...
[root@node3 named]#
[root@node3 named]# ll
total 40

在節點node1 新增配置檔案
[root@node1 ~]# vi /etc/resolv.conf

search localdomain
nameserver 192.168.1.176

依此測試連線3個scan ip 地址
[root@node1 ~]# nslookup 192.168.1.201
Server:         192.168.1.176
Address:        192.168.1.176#53

201.1.168.192.in-addr.arpa      name = scan-cluster.localdomain.

[root@node1 ~]# nslookup 192.168.1.202
Server:         192.168.1.176
Address:        192.168.1.176#53

202.1.168.192.in-addr.arpa      name = scan-cluster.localdomain.

[root@node1 ~]# nslookup 192.168.1.203
Server:         192.168.1.176
Address:        192.168.1.176#53

203.1.168.192.in-addr.arpa      name = scan-cluster.localdomain.



[root@node1 ~]# nslookup scan-cluster
Server:         192.168.1.176
Address:        192.168.1.176#53

Name:   scan-cluster.localdomain
Address: 192.168.1.202
Name:   scan-cluster.localdomain
Address: 192.168.1.203
Name:   scan-cluster.localdomain
Address: 192.168.1.201

在節點node2重複剛才的測試
[root@node2 ~]# vi /etc/resolv.conf

search localdomain
nameserver 192.168.1.176

[root@node2 ~]# nslookup 192.168.1.201
Server:         192.168.1.176
Address:        192.168.1.176#53

201.1.168.192.in-addr.arpa      name = scan-cluster.localdomain.

[root@node2 ~]# nslookup 192.168.1.202
Server:         192.168.1.176
Address:        192.168.1.176#53

202.1.168.192.in-addr.arpa      name = scan-cluster.localdomain.

[root@node2 ~]# nslookup 192.168.1.203
Server:         192.168.1.176
Address:        192.168.1.176#53

203.1.168.192.in-addr.arpa      name = scan-cluster.localdomain.

[root@node2 ~]# nslookup scan-cluster
Server:         192.168.1.176
Address:        192.168.1.176#53

Name:   scan-cluster.localdomain
Address: 192.168.1.201
Name:   scan-cluster.localdomain
Address: 192.168.1.202
Name:   scan-cluster.localdomain
Address: 192.168.1.203





來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29047826/viewspace-1224102/,如需轉載,請註明出處,否則將追究法律責任。

相關文章