Oracle gRGrid Infrastructure (CRS) 中引入了 Single Client Access Name (SCAN) 来简化客户端对数据库服务的访问
本文将详细介绍如何配置 DNS 来解析 SCAN VIP
演示环境 OracleEnterprise Linux
一安装 DNS Server rpm ivhbindPelirpm
rpm ivhbindchrootPelirpm
rpm ivhcachingnameserverPelirpm
DNS的守护进程
/usr/sbin/named
/usr/sbin/rndc
DNS的脚本
/etc/initd/named
DNS的端口
(tcp udp)
DNS的配置文件
/var/named/chroot/etc/nf(主配置文件)
/var/named/chroot/*
二配置 DNS Server 创建主配置文件 nf
[root@rac Server]#cd /var/named/chroot/etc
[root@rac etc]# lslt
total
rwr rootnamed Jun : rndckey
rwr rootnamed Jan namedcanf
rwr rootnamed Jan namedrfczones
rwrr rootroot Feb localtime
[root@rac etc]#more namedcanf
//
//namedcanf
//
// Provided by RedHat cachingnameserver package to configure the
// ISC BIND named()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 systemconfigbind or an editor
// tocreate nf edits to this file will be lost on
// cachingnameserver package upgrade
//
创建 nf 配置文件
[root@rac etc]# cpp namedcanf nf
[root@rac etc]# lslt
total
rwr rootnamed Jun : rndckey
rwr rootnamed Jan namedcanf
rwr rootnamed Jan nf
rwr rootnamed Jan namedrfczones
rwrr rootroot Feb localtime
编辑刚刚创建的 nf 文件按照如下方式修改
listenon port { ; };
allowquery { localhost; };
matchclients { localhost; };
matchdestinations { localhost; };
allowquerycache { localhost; };
将上述entry中的 host 信息全部修改为 any注意保留源文件中的空格
配置正向解析和反向解析 zone
配置正向解析 zone
[root@rac etc]# vinamedrfczones
zone IN {
type master;
file racoraclezone;
allowupdate { none; };
};
配置反向解析 zone
[root@rac etc]# vinamedrfczones
zoneinaddrarpa IN {
type master;
file racoraclelocal;
allowupdate { none; };
};
这里需要注意的是反向解析从左到右读取ip地址时是以相反的方向解释的所以需要将ip地址反向排列这里*网段的反向解析域名为inaddrarpa
利用模板文件创建用于正向解析和反向解析数据库文件
[root@rac etc]# cd/var/named/chroot/var/named
[root@rac named]#ls lt
total
rwr root named Jan localdomainzone
rwr root named Jan localhostzone
rwr root named Jan namedbroadcast
rwr root named Jan namedca
rwr root named Jan namediplocal
rwr root named Jan namedlocal
rwr root named Jan namedzero
drwxrwx namednamed Aug data
drwxrwx namednamed Jul slaves
创建正向解析数据库文件
[root@racnamed]# cp p localhostzoneracoraclezone
创建方向解析数据库文件
[root@racnamed]# cp p namedlocalracoraclelocal
配置正向解析数据库文件
[root@rac named]#vim racoraclezone
$TTL
@ IN SOA (
; serial (d adams)
H ; refresh
M ; retry
W ; expiry
D ) ; minimum
IN NS
racscan IN A
racscan IN A
racscan IN A
注意无论RAC有多少节点SCAN VIP 的个数只能有个
配置反向解析数据库文件
[root@rac named]#vim racoraclelocal
$TTL
@ IN SOA (
; Serial
; Refresh
; Retry
; Expire
) ; Minimum
IN NS
IN PT
IN PT
IN PT
注意
() 数字写IP 地址的最后一个如 就写
() racscan 后面有一个点
重启 DNS Server
[root@rac named]#service named restart
Stopping named:[ OK ]
Starting named:[ OK ]
配置 DNS 客户端
[root@rac named]#more /etc/nf
#search
#nameserver
nameserver
注意如有必要刻意修改 /etc/nf 文件配置主机解析方式
验证 DNS 配置
[root@rac named]#nslookup
Server:
Address: #
inaddrarpa name =
[root@rac named]#cd /var/named/chroot/var/named
[root@rac named]#nslookup racscan
Server:
Address: #
Name:
Address:
Name:
Address:
Name:
Address:
[root@rac named]#nslookup
Server:
Address: #
Name:
Address:
Name:
Address:
Name:
Address:
[root@rac named]#nslookup
Server:
Address: #
inaddrarpa name =
#eth PUBLIC
rac
rac
#VIP
racvip
racvip
#eth PRIVATE
racpriv
racpriv