有关于Oracle Linux 6的安装可以参考Oracle Linux 6 Installation。安装两台OL6分配两个网卡内存均为3G,hostname分别为node1和node2。
OS版本你也可以选择CentOS6或者是RHEL6,建议初次安装选择CentOS6/RHEL6。选择Oracle Linux6可以使用OL6提供的oracle-rdbms-server-11gR2-preinstall来简化oracle database software和grid infrastructure的安装,目前在RHEL6/OL6 Linux上认证的唯一数据库版本为11.2.0.3.
oracle11gR2 RAC引入了SCANIP(集群的单客户端访问名称)
如果您曾经通过添加新节点来扩展 Oracle RAC(或者通过删除节点来缩小 RAC),更新每个客户端的 SQL*Net 或 JDBC 配置以反映这个新增或删除的节点!为解决此问题,Oracle 11g R2引入了一个新特性,即单客户端访问名称(简称为 SCAN)。SCAN 这个新特性为客户端提供了单一的主机名,用于访问集群中运行的 Oracle 数据库。如果您在集群中添加或删除节点,使用 SCAN 的客户端无需更改自己的 TNS 配置。无论集群包含哪些节点,SCAN 资源及其关联的 IP 地址提供了一个稳定的名称供客户端进行连接使用。在 Oracle Grid Infrastructure 安装过程的询问阶段,系统会要求您提供主机名和最多三个 IP 地址以便用于 SCAN 资源。为了获得较高的可用性和可伸缩性,Oracle 建议你对 SCAN 名称进行配置,以便解析为三个 IP 地址。SCAN 必须至少解析为一个地址。
SCAN 虚拟 IP 名称类似于节点的虚拟 IP 地址所使用的名称,如 node1-vip。然而,与虚拟 IP 不同的是,SCAN 与整个集群相关联,而不是与一个节点相关联,它可与多个 IP 地址相关联,而不是只与一个地址相关联。注意,SCAN 地址、虚拟 IP 地址和公共 IP 地址必须属于同一子网。
这里我在dns服务器中定义scanip,dns服务器ip为192.168.1.200。
以下操作在dns服务器上
安装bind等相关软件
[root@dns ~]# yum install bind bind-devel bind-chroot caching-nameserver
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
base | 1.1 kB 00:00
base/primary | 1.2 MB 00:09
base 3591/3591
extras | 2.1 kB 00:00
extras/primary_db | 207 kB 00:00
updates | 1.9 kB 00:00
updates/primary_db | 1.0 MB 00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 30:9.3.6-20.P1.el5_8.5 set to be updated
--> Processing Dependency: bind-libs = 30:9.3.6-20.P1.el5_8.5 for package: bind
---> Package bind-chroot.x86_64 30:9.3.6-20.P1.el5_8.5 set to be updated
---> Package bind-devel.i386 30:9.3.6-20.P1.el5_8.5 set to be updated
--> Processing Dependency: libbind9.so.0 for package: bind-devel
--> Processing Dependency: libisccc.so.0 for package: bind-devel
--> Processing Dependency: libdns.so.26 for package: bind-devel
--> Processing Dependency: libisccfg.so.1 for package: bind-devel
--> Processing Dependency: liblwres.so.9 for package: bind-devel
--> Processing Dependency: libisc.so.15 for package: bind-devel
---> Package bind-devel.x86_64 30:9.3.6-20.P1.el5_8.5 set to be updated
---> Package caching-nameserver.x86_64 30:9.3.6-20.P1.el5_8.5 set to be updated
--> Running transaction check
--> Processing Dependency: bind-libs = 30:9.3.6-16.P1.el5 for package: bind-utils
---> Package bind-libs.i386 30:9.3.6-20.P1.el5_8.5 set to be updated
---> Package bind-libs.x86_64 30:9.3.6-20.P1.el5_8.5 set to be updated
--> Running transaction check
---> Package bind-utils.x86_64 30:9.3.6-20.P1.el5_8.5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================
Installing:
bind x86_64 30:9.3.6-20.P1.el5_8.5 updates 989 k
bind-chroot x86_64 30:9.3.6-20.P1.el5_8.5 updates 47 k
bind-devel i386 30:9.3.6-20.P1.el5_8.5 updates 2.8 M
bind-devel x86_64 30:9.3.6-20.P1.el5_8.5 updates 2.8 M
caching-nameserver x86_64 30:9.3.6-20.P1.el5_8.5 updates 64 k
Installing for dependencies:
bind-libs i386 30:9.3.6-20.P1.el5_8.5 updates 864 k
Updating for dependencies:
bind-libs x86_64 30:9.3.6-20.P1.el5_8.5 updates 897 k
bind-utils x86_64 30:9.3.6-20.P1.el5_8.5 updates 180 k
Transaction Summary
=======================================================================================================================================================================
Install 6 Package(s)
Upgrade 2 Package(s)
Total download size: 8.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): bind-chroot-9.3.6-20.P1.el5_8.5.x86_64.rpm | 47 kB 00:00
(2/8): caching-nameserver-9.3.6-20.P1.el5_8.5.x86_64.rpm | 64 kB 00:00
(3/8): bind-utils-9.3.6-20.P1.el5_8.5.x86_64.rpm | 180 kB 00:00
(4/8): bind-libs-9.3.6-20.P1.el5_8.5.i386.rpm | 864 kB 00:00
(5/8): bind-libs-9.3.6-20.P1.el5_8.5.x86_64.rpm | 897 kB 00:00
(6/8): bind-9.3.6-20.P1.el5_8.5.x86_64.rpm | 989 kB 00:00
(7/8): bind-devel-9.3.6-20.P1.el5_8.5.i386.rpm | 2.8 MB 00:11
(8/8): bind-devel-9.3.6-20.P1.el5_8.5.x86_64.rpm | 2.8 MB 00:02
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 315 kB/s | 8.5 MB 00:27
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
updates/gpgkey | 1.5 kB 00:00
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : bind-libs 1/10
Installing : bind 2/10
Installing : bind-libs 3/10
Installing : bind-chroot 4/10
Installing : caching-nameserver 5/10
Installing : bind-devel 6/10
Updating : bind-utils 7/10
Installing : bind-devel 8/10
Cleanup : bind-libs 9/10
Cleanup : bind-utils 10/10
Installed:
bind.x86_64 30:9.3.6-20.P1.el5_8.5 bind-chroot.x86_64 30:9.3.6-20.P1.el5_8.5 bind-devel.i386 30:9.3.6-20.P1.el5_8.5
bind-devel.x86_64 30:9.3.6-20.P1.el5_8.5 caching-nameserver.x86_64 30:9.3.6-20.P1.el5_8.5
Dependency Installed:
bind-libs.i386 30:9.3.6-20.P1.el5_8.5
Dependency Updated:
bind-libs.x86_64 30:9.3.6-20.P1.el5_8.5 bind-utils.x86_64 30:9.3.6-20.P1.el5_8.5
Complete!
修改配置文件,将localhost和127.0.0.1修改为any
[root@dns ~]# cd /var/named/chroot/etc/
[root@dns etc]# cp -p named.caching-nameserver.conf named.conf
[root@dns etc]# cat 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 localhost 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 localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
[root@dns etc]# cat named.rfc1912.zones
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
type hint;
file "named.ca";
};
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
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; };
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.zero";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa." IN {
type master;
file "1.168.192.in-addr.arpa";
allow-update { none; };
};
配置正,反向解析数据库文件,在反向解析文件中加入
57 IN PTR cluster-scan.localdomain.
58 IN PTR cluster-scan.localdomain.
59 IN PTR cluster-scan.localdomain.
[root@dns etc]# cd /var/named/chroot/var/named/
[root@dns named]# cp -p named.local 1.168.192.in-addr.arpa
[root@dns named]# cat 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.
57 IN PTR cluster-scan.localdomain.
58 IN PTR cluster-scan.localdomain.
59 IN PTR cluster-scan.localdomain.
[root@dns named]# pwd
/var/named/chroot/var/named
[root@dns named]# cat 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
cluster-scan IN A 192.168.1.57
cluster-scan IN A 192.168.1.58
cluster-scan IN A 192.168.1.59
启动dns
[root@dns named]# /etc/init.d/named start
Starting named: [ OK ]
到此dns服务器上的操作完毕。
在node1和node2的/etc/resolv.conf文件加上
nameserver 192.168.1.200
[root@node1 ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.1.200
nameserver 61.147.37.1
[root@node2 ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.1.200
nameserver 61.147.37.1
测试dns,node1和node2的hosts文件配置
#node1
192.168.1.51 node1.localdomain node1
192.168.1.151 node1-vip.localdomain node1-vip
172.168.1.51 node1-priv.localdomain node1-priv
#node2
192.168.1.52 node2.localdomain node2
192.168.1.152 node2-vip.localdomain node2-vip
172.168.1.52 node2-priv.localdomain node2-priv
#scanip
192.168.1.57 cluster-scan.localdomain cluster-scan
192.168.1.58 cluster-scan.localdomain cluster-scan
192.168.1.59 cluster-scan.localdomain cluster-scan
node1
[root@node1 ~]# nslookup 192.168.1.57
Server: 192.168.1.200
Address: 192.168.1.200#53
57.1.168.192.in-addr.arpa name = cluster-scan.localdomain.
[root@node1 ~]# nslookup 192.168.1.58
Server: 192.168.1.200
Address: 192.168.1.200#53
58.1.168.192.in-addr.arpa name = cluster-scan.localdomain.
[root@node1 ~]# nslookup 192.168.1.59
Server: 192.168.1.200
Address: 192.168.1.200#53
59.1.168.192.in-addr.arpa name = cluster-scan.localdomain.
[root@node1 ~]# nslookup cluster-scan
Server: 192.168.1.200
Address: 192.168.1.200#53
Name: cluster-scan.localdomain
Address: 192.168.1.58
Name: cluster-scan.localdomain
Address: 192.168.1.59
Name: cluster-scan.localdomain
Address: 192.168.1.57
[root@node1 ~]# nslookup cluster-scan.localdomain
Server: 192.168.1.200
Address: 192.168.1.200#53
Name: cluster-scan.localdomain
Address: 192.168.1.57
Name: cluster-scan.localdomain
Address: 192.168.1.58
Name: cluster-scan.localdomain
Address: 192.168.1.59
[root@node2 ~]# nslookup 192.168.1.57
Server: 192.168.1.200
Address: 192.168.1.200#53
57.1.168.192.in-addr.arpa name = cluster-scan.localdomain.
[root@node2 ~]# nslookup 192.168.1.58
Server: 192.168.1.200
Address: 192.168.1.200#53
58.1.168.192.in-addr.arpa name = cluster-scan.localdomain.
[root@node2 ~]# nslookup 192.168.1.59
Server: 192.168.1.200
Address: 192.168.1.200#53
59.1.168.192.in-addr.arpa name = cluster-scan.localdomain.
[root@node2 ~]# nslookup cluster-scan
Server: 192.168.1.200
Address: 192.168.1.200#53
Name: cluster-scan.localdomain
Address: 192.168.1.59
Name: cluster-scan.localdomain
Address: 192.168.1.57
Name: cluster-scan.localdomain
Address: 192.168.1.58
[root@node2 ~]# nslookup cluster-scan.localdomain
Server: 192.168.1.200
Address: 192.168.1.200#53
Name: cluster-scan.localdomain
Address: 192.168.1.58
Name: cluster-scan.localdomain
Address: 192.168.1.59
Name: cluster-scan.localdomain
Address: 192.168.1.57