当前位置:数据库 > Oracle >>

Oracle 11g R2 RAC:配置DNS解析SCAN VIP

Oracle 11g R2 RAC:配置DNS解析SCAN VIP
 
Oracle 11gR2Grid Infrastructure (CRS) 中引入了 Single Client Access Name (SCAN) 来简化客户端对数据库服务的访问。
本文将详细介绍如何配置 DNS 来解析 SCAN VIP
 
演示环境
OracleEnterprise Linux 5.6
 
一、安装 DNS Server
 
rpm -ivhbind-9.3.6-16.P1.el5.i386.rpm
rpm -ivhbind-chroot-9.3.6-16.P1.el5.i386.rpm
rpm -ivhcaching-nameserver-9.3.6-16.P1.el5.i386.rpm

DNS的守护进程
/usr/sbin/named   
/usr/sbin/rndc
DNS的脚本
/etc/init.d/named
DNS的端口
53       953(tcp udp) 
DNS的配置文件
/var/named/chroot/etc/named.conf(主配置文件)  
/var/named/chroot/*

 

 
二、配置 DNS Server
1、创建主配置文件 named.conf
[root@rac1 Server]#cd /var/named/chroot/etc
[root@rac1 etc]# ls-lt
total 24
-rw-r----- 1 rootnamed  113 Jun  1 07:46 rndc.key
-rw-r----- 1 rootnamed 1230 Jan 14  2011named.caching-nameserver.conf
-rw-r----- 1 rootnamed  955 Jan 14  2011 named.rfc1912.zones
-rw-r--r-- 1 rootroot  3519 Feb 27  2006 localtime

[root@rac1 etc]#more named.caching-nameserver.conf
//
//named.caching-nameserver.conf
//
// Provided by RedHat caching-nameserver package to configure the
// ISC BIND named(8)DNS server as a caching only nameserver
// (as a localhostDNS resolver only).
//
// See/usr/share/doc/bind*/sample/ for example named configuration files.
//
// DONOT EDIT THIS FILE - use system-config-bind or an editor
// tocreate named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//

------创建 named.conf 配置文件
[root@rac1 etc]# cp-p named.caching-nameserver.conf named.conf
[root@rac1 etc]# ls-lt
total 28
-rw-r----- 1 rootnamed  113 Jun  1 07:46 rndc.key
-rw-r----- 1 rootnamed 1230 Jan 14  2011named.caching-nameserver.conf
-rw-r----- 1 rootnamed 1230 Jan 14  2011 named.conf
-rw-r----- 1 rootnamed  955 Jan 14  2011 named.rfc1912.zones
-rw-r--r-- 1 rootroot  3519 Feb 27  2006 localtime

-------编辑刚刚创建的 named.conf 文件,按照如下方式修改:
 listen-on port 53 { 127.0.0.1; };
 allow-query { localhost; };
 match-clients { localhost; };
 match-destinations { localhost; };
 allow-query-cache { localhost; };

 

将上述entry中的 host 信息全部修改为 any,注意保留源文件中的空格
 
 
2、配置正向解析和反向解析 zone
------配置正向解析 zone
[root@rac1 etc]# vinamed.rfc1912.zones
zone"oracle.com" IN {
 type master;
 file "rac.oracle.zone";
 allow-update { none; };
};

------配置反向解析 zone
[root@rac1 etc]# vinamed.rfc1912.zones
zone"8.168.192.in-addr.arpa" IN {
 type master;
 file "rac.oracle.local";
 allow-update { none; };
};

 

 
这里需要注意的是,反向解析从左到右读取ip地址时是以相反的方向解释的,所以需要将ip地址反向排列。这里,192.168.8.*网段的反向解析域名为"8.168.192.in-addr.arpa"。
 
3、利用模板文件创建用于正向解析和反向解析数据库文件
[root@rac1 etc]# cd/var/named/chroot/var/named
[root@rac1 named]#ls -lt
total 44
-rw-r----- 1root  named  198 Jan 14 2011 localdomain.zone
-rw-r----- 1root  named  195 Jan 14 2011 localhost.zone
-rw-r----- 1root  named  427 Jan 14 2011 named.broadcast
-rw-r----- 1root  named 1892 Jan 14  2011 named.ca
-rw-r----- 1root  named  424 Jan 14 2011 named.ip6.local
-rw-r----- 1root  named  426 Jan 14 2011 named.local
-rw-r----- 1root  named  427 Jan 14 2011 named.zero
drwxrwx--- 2 namednamed 4096 Aug 26  2004 data
drwxrwx--- 2 namednamed 4096 Jul 27  2004 slaves

-----创建正向解析数据库文件
[root@rac1named]#  cp -p localhost.zonerac.oracle.zone

-----创建方向解析数据库文件
[root@rac1named]#  cp -p named.localrac.oracle.local

-----配置正向解析数据库文件
[root@rac1 named]#vim rac.oracle.zone
$TTL 86400
@ IN SOA oracle.comroot.oracle.com (
 42 ; serial (d. adams)
 3H ; refresh
 15M ; retry
 1W ; expiry
 1D ) ; minimum
 IN NS oracle.com
rac-scan IN A192.168.8.31
rac-scan IN A192.168.8.32
rac-scan IN A192.168.8.33

注意:无论RAC有多少节点,SCAN VIP 的个数只能有3个

-----配置反向解析数据库文件
[root@rac1 named]#vim rac.oracle.local

$TTL 86400
@ IN SOA oracle.com.root.oracle.com. (
 1997022700 ; Serial
 28800 ; Refresh
 14400 ; Retry
 3600000 ; Expire
 86400 ) ; Minimum
 IN NS oracle.com.
31 IN PTRrac-scan.oracle.com.
32 IN PTRrac-scan.oracle.com.
33 IN PTRrac-scan.oracle.com.

 

 
注意:
(1) 数字写IP 地址的最后一个。如192.168.6.100, 就写100
(2) rac-scan. 后面有一个点
 
4、重启 DNS Server
[root@rac1 named]#service named restart
Stopping named:[  OK ]
Starting named:[  OK ]

 

 
5、配置 DNS 客户端
[root@rac1 named]#more /etc/resolv.conf
#search oracle.com
#nameserver 8.8.8.8
nameserver192.168.8.11

 

 
注意,如有必要刻意修改 /etc/nsswitch.conf 文件配置主机解析方式
 
6、验证 DNS 配置
[root@rac1 named]#nslookup 192.168.8.32
Server:         192.168.8.11
Address:        192.168.8.11#53

32.8.168.192.in-addr.arpa       name = rac-scan.oracle.com.

[root@rac1 named]#cd /var/named/chroot/var/named
[root@rac1 named]#nslookup rac-scan
Server:         192.168.8.11
Address:        192.168.8.11#53

Name:   rac-scan.oracle.com
Address:192.168.8.31
Name:   rac-scan.oracle.com
Address:192.168.8.32
Name:   rac-scan.oracle.com
Address:192.168.8.33

[root@rac1 named]#nslookup rac-scan.oracle.com
Server:         192.168.8.11
Address:        192.168.8.11#53

Name:   rac-scan.oracle.com
Address:192.168.8.33
Name:   rac-scan.oracle.com
Address:192.168.8.31
Name:   rac-scan.oracle.com
Address:192.168.8.32

[root@rac1 named]#nslookup 192.168.8.32
Server:         192.168.8.11
Address:        192.168.8.11#53

32.8.168.192.in-addr.arpa       name = rac-scan.oracle.com.

#eth0 - PUBLIC
192.168.8.11rac1.oracle.com rac1
192.168.8.12rac2.oracle.com rac2
#VIP
192.168.8.21rac1-vip.oracle.com rac1-vip
192.168.8.22rac2-vip.oracle.com rac2-vip
#eth1 - PRIVATE
10.10.10.11rac1-priv1
10.10.10.12rac2-priv2

 


CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,