一.基本資訊
本檔案将配置DNS伺服器,并且測試oracle11Gr2下使用SCAN和DNS配置網絡連接配接。
本檔案涉及到的機器
DNS機器 | 叢集節點1 | 叢集節點1 | 用戶端 | |
OS | Rhel63 | Rhel63 | Rhel63 | Win7 |
IP | 192.168.114.138 | IP:192.168.114.141 VIP:192.168.114.143 Priv:172.168.114.141 | IP:192.168.114.142 VIP:192.168.114.144 Priv:172.168.114.142 | 192.168.114.127 |
SCAN IP: 192.168.114.145 192.168.114.146 192.168.114.147 | ||||
# cat /etc/issue
Red Hat Enterprise Linux Server release 6.3(Santiago)
Kernel \r on an \m
SQL> select * from V$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise EditionRelease 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 -Production
NLSRTL Version 11.2.0.4.0 - Production
二.DNS伺服器配置:
安裝相應的包
[[email protected] ~]# yum install bind bind-devel bind-chrootcaching-nameserver
[[email protected] ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.114.138
保證resolv.conf不會自動修改
[[email protected] ~]#chattr+i /etc/resolv.conf
修改named.conf
[[email protected] ~]# vi/etc/named.conf
修改:
listen-on port 53 {any; };
allow-query { any; }; --也可以是具體IP段,如192.168.110.0/24;
并為配置簡單,将一些安裝相關的用//注釋掉
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";
allow-query { any; };
recursion yes;
// dnssec-enable yes;
// dnssec-validation yes;
// dnssec-lookaside auto;
// bindkeys-file "/etc/named.iscdlv.key";
// managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file"data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include"/etc/named.rfc1912.zones";
//include "/etc/named.root.key";
named.conf中隻有“.”區域,其他的在/etc/named.rfc1912.zones中配置
修改/etc/named.rfc1912.zones
在/etc/named.rfc1912.zones中建立正向反向區域
[[email protected] ~]# vi/etc/named.rfc1912.zones
加入下面兩部分
zone "pera.com"IN {
type master;
file "pera.com.zone";
allow-update { none; };
};
zone "114.168.192.in-addr.arpa"IN {
type master;
file "192.168.114.arpa";
allow-update { none; };
};
建立正反向解析檔案
[[email protected] ~]# cd /var/named/
[[email protected] named]# cp -p named.localhost pera.com.zone
[[email protected] named]# cp -p named.localhost 192.168.114.arpa
修改正向解析:
[[email protected] named]# vi /var/named/pera.com.zone
$TTL 5M
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H) ; minimum
NS @
A 192.168.114.138
AAAA ::1
dns A 192.168.114.138
DNS1 CNAME dns
ftp A 192.168.114.138
mail A 192.168.114.138
racn-cluster-scan A 192.168.114.145
racn-cluster-scan A 192.168.114.146
racn-cluster-scan A 192.168.114.147
@ MX 5 mail.localdomain
$GENERATE 10-250 stu$ A 192.168.114.$
修改反向解析:
[[email protected] ~]# vi/var/named/192.168.114.arpa
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H) ; minimum
NS pera.com.
A 127.0.0.1
AAAA ::1
138 PTR dns
145 PTR racn-cluster-scan.pera.com.
146 PTR racn-cluster-scan.pera.com.
147 PTR racn-cluster-scan.pera.com.
啟動named
[[email protected] named]# /etc/rc.d/init.d/namedrestart
Stopping named: [ OK ]
Starting named: [ OK ]
檢查
[[email protected] ~]# netstat -anp|grep :53
tcp 0 0 192.168.114.138:53 0.0.0.0:* LISTEN 2104/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2104/named
tcp 0 0 ::1:53 :::* LISTEN 2104/named
udp 0 0 0.0.0.0:5353 0.0.0.0:* 1930/avahi-daemon
udp 0 0 172.168.146.138:53 0.0.0.0:* 2104/named
udp 0 0 192.168.114.138:53 0.0.0.0:* 2104/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 2104/named
udp 0 0 ::1:53 :::* 2104/named
[[email protected]~]# nslookup
> 192.168.114.138
Server: 192.168.114.138
Address: 192.168.114.138#53
138.114.168.192.in-addr.arpa name = dns.pera.com.
> dns
Server: 192.168.114.138
Address: 192.168.114.138#53
Name: dns.pera.com
Address: 192.168.114.138
> dns1
Server: 192.168.114.138
Address: 192.168.114.138#53
dns1.pera.com canonical name = dns.pera.com.
Name: dns.pera.com
Address: 192.168.114.138
> racn-cluster-scan
Server: 192.168.114.138
Address: 192.168.114.138#53
Name: racn-cluster-scan.pera.com
Address: 192.168.114.145
Name: racn-cluster-scan.pera.com
Address: 192.168.114.146
Name: racn-cluster-scan.pera.com
Address: 192.168.114.147
> racn-cluster-scan.pera.com
Server: 192.168.114.138
Address: 192.168.114.138#53
Name: racn-cluster-scan.pera.com
Address: 192.168.114.146
Name: racn-cluster-scan.pera.com
Address: 192.168.114.147
Name: racn-cluster-scan.pera.com
Address: 192.168.114.145
> 192.168.114.146
Server: 192.168.114.138
Address: 192.168.114.138#53
146.114.168.192.in-addr.arpa name = racn-cluster-scan.pera.com.
三.叢集使用scan和DNS通路
修改叢集兩節點的resolv.conf
其他linux通路時隻需要修改:
[[email protected] grid]# vi /etc/resolv.conf
search localdomain
nameserver 192.168.114.138
保證resolv.conf不會自動修改
chattr +i /etc/resolv.conf
叢集節點hosts檔案
[[email protected] ~]# more /etc/hosts
127.0.0.1 localhost localhost.pera.com localhost4 localhost4.pera.com4
::1 localhost localhost.pera.com localhost6 localhost6.pera.com6
192.168.114.141 racn1.pera.com racn1
192.168.114.142 racn2.pera.com racn2
192.168.114.143 racn1-vip.pera.com racn1-vip
192.168.114.144 racn2-vip.pera.com racn2-vip
172.168.1.141 racn1-priv.pera.com racn1-priv
172.168.1.142 racn2-priv.pera.com racn2-priv
192.168.114.145 racn-cluster-scan.pera.com racn-cluster-scan
192.168.114.146 racn-cluster-scan.pera.com racn-cluster-scan
192.168.114.147 racn-cluster-scan.pera.com racn-cluster-scan
在保證以前内容正确的條件進行叢集安裝或修改現在叢集,保證scan ip的通路正常(本文不做讨論)
可參考:http://blog.csdn.net/bamuta/article/details/24410801
四.在用戶端連接配接該叢集
Windows下進行連接配接:
首先需要,配好DNS:
修改tnsnames.ora
vmpera =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = racn-cluster-scan.pera.com)(PORT =1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pera)
)
)
另外需要修改hosts檔案把加入以下内容
192.168.114.127 localhost
--經測試,加入本網段内任一IP都可以,不管能不能ping通。
進行連接配接
SQL> conn system/[email protected]
已連接配接。
簡單測試具有oad_balance功能,在不同的連接配接中連接配接到的執行個體不同。