您好,登錄后才能下訂單哦!
Oracle 11g RAC SCAN ip的原理及配置
Oracle 11g RAC網格即插即用(GPnP)工作原理:
SCAN概念:
先介紹一下什么叫SCAN,SCAN(Single Client Access Name)是Oracle從11g R2開始推出的,客戶端可以通過SCAN特性負載均衡地連接到RAC數據庫。SCAN提供一個域名來訪問RAC,域名可以解析1個到3個(注意,最多3個)SCAN IP,我們可以通過DNS或者GNS來解析實現。其中DNS大家都很熟悉,這里不多說。GNS(Grid Naming Service)則是Oracle 11g R2的新功能,可以通過DHCP服務為節點和SCAN分配VIP和SCAN IP。另外還有個優點是,對于新加入集群的節點,它會自動分配VIP地址,更新集群資源,客戶端依然通過SCAN特性負載均衡地連接到新增集群節點上。DNS和GNS配置與解析相關內容在下面還有說明。
除了DNS和GNS解析方法外,SCAN也可以使用hosts文件來解析,但用過的人都知道,此方法不僅在安裝RAC的時候產生問題,后期使用也是存在問題的,比如SCAN域名只能定義一個SCAN IP。所以這種方法也是Oracle不推薦使用的。但盡管如此,很多生產上依然這樣使用,也就是廢棄了11g的新特性SCAN,而是依然采用VIP連接方式。
SCAN ip 工作原理:
通過DNS配置SCAN IP:
以下案例是在Linux環境下配置DNS服務器:
步驟:
1、 安裝必要軟件
[root@Dns_master/]# yum install bind bind-chroot caching-nameserver –y
….
Installed:
bind.i38630:9.3.6-4.P1.el5_4.2
bind-chroot.i386 30:9.3.6-4.P1.el5_4.2 (可以不安裝)
caching-nameserver.i386 30:9.3.6-4.P1.el5_4.2
2、 配置
1)修改主配置文件
[root@Dns_master /]# cd/var/named/chroot/
[root@Dns_masterchroot]# pwd
/var/named/chroot
[root@Dns_masterchroot]# ls
dev etc var
[root@Dns_masterchroot]# cd etc/
[root@Dns_masteretc]# ls
localtime named.caching-nameserver.conf named.rfc1912.zones rndc.key
[root@Dns_master etc]# vi named.caching-nameserver.conf
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; }; #查詢地址
};
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";
};
2)聲明一個域
[root@Dns_masteretc]# pwd
/var/named/chroot/etc
[root@Dns_masteretc]# ls
localtime named.caching-nameserver.conf named.rfc1912.zones rndc.key
[root@Dns_master etc]# vi named.rfc1912.zones
zone "." IN {
type hint;
file "named.ca";
};
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "cuug.net" IN {
type master;
file "cuug.zone";
notify no;
};
zone "8.168.192.in-addr.arpa" IN {
type slave;
file "192.zone";
notify no;
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
3)建立對應的正解和反向區域文件
[root@Dns_masteretc]# cd ../var/named/
[root@Dns_masternamed]# pwd
/var/named/chroot/var/named
[root@Dns_masternamed]# ls
data localhost.zone named.ca named.local slaves
localdomain.zone named.broadcast named.ip6.local named.zero
正向解析文件:
[root@Dns_master named]# cat cuug.zone
$TTL 86400
@ IN SOA dns.cuug.net. root.mail.cuug.net. (
1997022700 ; Serial
28800 ; Refresh - 3 hours
14400 ; Retry - 1 hour
3600000 ; Expire - 1 week
86400) ; Minimum - 1 day
IN NS dns.cuug.net.
IN MX 10 mail.cuug.net.
dns IN A 192.168.8.240
scan IN A 192.168.8.100
scan IN A 192.168.8.101
scan IN A 192.168.8.102
反向解析文件:
[root@Dns_master named]# cat 192.zone
$TTL 86400
@ IN SOA dns.cuug.net. root.mail.cuug.net. (
1997022700 ; Serial
28800 ; Refresh - 3 hours
14400 ; Retry - 1 hour
3600000 ; Expire - 1 week
86400) ; Minimum - 1 day
IN NS dns.cuug.net.
IN MX 10 mail.cuug.net.
240 IN PTR dns.cuug.net.
100 IN PTR scan.cuug.net.
101 IN PTR scan.cuug.net.
102 IN PTR scan.cuug.net.
本機反向解析庫文件:
net.127
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh - 3 hours
14400 ; Retry - 1 hour
3600000 ; Expire - 1 week
86400) ; Minimum - 1 day
IN NS localhost.
1 IN PTR localhost.
本機正向解析庫文件:
net.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh - 3 hours
14400 ; Retry - 1 hour
3600000 ; Expire - 1 week
86400) ; Minimum - 1 day
IN NS localhost.
localhost IN A 127.0.0.1
4)修改區域文件的權限
[root@Dns_master named]# chown :named cuug.zone
[root@Dns_master named]# chown :named 192.zone
5)檢查配置文件語法
[root@Dns_master named]#named-checkconf ###檢測配置文件是否有語法錯誤
[root@Dns_master named]#named-checkzone cuug.net cuug.zone
zonelinuxidc/IN: loaded serial 42
OK
3、重新啟動named服務
[root@Dns_master named]# service named restart
停止 named: [確定]
啟動 named: [確定]
4、測試
首先添加DNS服務器記錄
編輯nsswitch.conf 添加dns解析
[root@Dns_master named]# vi /etc/nsswitch.conf
在hosts: dns files 增加DNS解析
[root@Dns_masternamed]# cat /etc/resolv.conf
nameserver192.168.8.240
[root@Dns_masternamed]# host scan.cuug.net
scan.cuug.net has address 192.168.1.100
scan.cuug.net has address 192.168.1.100
scan.cuug.net has address 192.168.1.100
@至此,通過DNS解析scan ip成功!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。