dns+dhcp+gns oracle_oracle 12c gns dns 配置 - CSDN
精华内容
参与话题
  • Oracle 11g RAC SCAN ip的原理及配置

    千次阅读 2018-03-07 11:02:25
    SCAN概念: 先介绍一下什么叫SCAN,SCAN(Single Client Access Name)是Oracle从11g R2开始推出的,客户端可以通过SCAN特性负载均衡地连接到RAC数据库。所以在Oracle 11gR2 中,引入了SCAN(Single ClientAccess ...
    SCAN概念:
        先介绍一下什么叫SCAN,SCAN(Single Client Access Name)是Oracle从11g R2开始推出的,客户端可以通过SCAN特性负载均衡地连接到RAC数据库。所以在Oracle 11gR2 中,引入了SCAN(Single ClientAccess Name)的特性。SCAN是一个域名,可以解析至少1个IP,最多解析3个SCAN IP,客户端可以通过这个SCAN 名字来访问数据库,另外SCAN ip必须与public ip和VIP在一个子网。
    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 工作原理:



    启用SCAN 之后,会在数据库与客户端之间,添加了一层虚拟的服务层,就是SCAN IP和SCAN IP Listener,在客户端仅需要配置SCAN IP的tns信息,通过SCANIP Listener,连接后台集群数据库。这样,不论集群数据库是否有添加或者删除节点的操作,均不会对客户端产生影响,也就不需要修改配置。

    配置SCAN有3种方法:
    1. 使用/etc/hosts文件
    这个是我们目前用的最多的方式,但是缺点只能对应一个SCAN IP,该方法Oracle 不推荐,但是简单,不需要单独的DNS 服务器,使用该方法,客户端还是需要VIP来链接。 Oracle 推荐使用其他的2种方法来实现SCAN 功能。
    2. 在DNS中定义域名,只需要在DNS中配置即可实现SCAN 功能。


    .


    3. 通过Grid Naming Server(GNS),需要配置DNS 和DHCP才能实现SCAN 功能。

    .

    配置好之后,直接在客户端的tnsnames里写SCAN NAME就可以了,如下:

    RACSCAN =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan.gns.cndba.com)(PORT = 1521))

    (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = dave)

    )

    )

     

    以后RAC 增加删除节点,客户端都不需要修改。

    展开全文
  • Oracle 12c RAC 集群使用 GNS 实现 SCAN

    万次阅读 2017-12-01 13:25:16
     1 说明 在前面的Blog中,讲过RAC 中SCAN 的配置有三种方式:(1) /etc/hosts(2) DNS(3) GNS 具体链接如下:Oracle RAC 集群 SCAN 说明http://blog.csdn.net/tianlesoftware/article/details/42712979 ...

     

    注:本文谢绝转载!

     

    1   说明

     

    在前面的Blog中,讲过RAC 中SCAN 的配置有三种方式:

    (1) /etc/hosts

    (2) DNS

    (3) GNS

     

    具体链接如下:

    Oracle RAC 集群 SCAN 说明

    http://www.cndba.cn/Dave/article/758

     

    Oracle 12c RAC 集群使用DNS 实现 SCAN

    http://www.cndba.cn/Dave/article/757

     

    Oracle 12c RAC 修改SCAN 配置

    http://www.cndba.cn/Dave/article/756

     

    如果使用GNS来做SCAN,那么就需要配置DNS和 DHCP。 并且整个RAC的架构,也会发生变化。

     

    在我们传统的架构中,PUBLIC IP,PRIVATE IP,VIP 都是我们预先分配好的,但如果使用GNS 来做SCAN,那么只需要固定PRIVATEIP 和 PUBLIC IP, VIP和SCAN IP 由GNS 从DHCP 中动态获取。

     

     

    本测试的RAC搭建IP 分配如下表

     

    节点

    Public IP

    Private IP

    VIP

    SCAN VIP

    GNS VIP

    SCAN

    rac1

    192.168.56.5

    192.168.57.5

    从DHCP动态分配

    从DHCP动态分配

    192.168.56.201

    由DNS 解析

    DHCP中获得,并由GNS进行域名解析

    rac2

    192.168.56.6

    192.168.57.6

    dns/dhcp

    192.168.56.200

     

     

    2   安装配置DNS

     

    2.1             安装DNS

     

    安装:

    [root@rac1yum.repos.d]# yum search bind-

    Loadedplugins: refresh-packagekit, security

    ====================================================================N/S Matched: bind-=====================================================================

    bind-chroot.x86_64: A chroot runtime environment for the ISC BIND DNS server, named(8)

    bind-devel.i686: Header files and libraries needed for BIND DNS development

    bind-devel.x86_64: Header files and libraries needed for BIND DNS development

    bind-dyndb-ldap.x86_64: LDAP back-end plug-in for BIND

    bind-libs.x86_64: Libraries used by the BIND DNS packages

    bind-libs.i686: Libraries used by the BIND DNS packages

    bind-sdb.x86_64: BIND server with database backends and DLZ support

    bind-utils.x86_64: Utilities for querying DNS name servers

     

    [root@rac1sbin]# yum install bind-chroot.x86_64

     

    依赖的包会自动解决。

     

    [root@rac1etc]# rpm -qa | grep "^bind"

    bind-chroot-9.8.2-0.30.rc1.el6.x86_64

    bind-9.8.2-0.30.rc1.el6.x86_64

    bind-libs-9.8.2-0.30.rc1.el6.x86_64

    bind-utils-9.8.2-0.30.rc1.el6.x86_64

    [root@rac1etc]#

     

     

    2.2             配置DNS

    安装完成后,bind的主配置文件是/etc/named.conf;区域类型配置文件是/etc/named.rfc1912.zones;区域配置文件在/var/named/下;

     

     

    2.2.1 修改name.conf 文件

     

     

    [root@davedns ~]# cat /etc/named.conf

    //

    // named.conf

    //

    // Provided by Red Hat bind package to configure the ISC BINDnamed(8) DNS

    // server as a caching only nameserver (as a localhost DNS resolveronly).

    //

    // See /usr/share/doc/bind*/sample/ for example named configurationfiles.

    //

     

    options {

    //         listen-onport 53 { 127.0.0.1; };默认监听IP为127.0.0.1,用//需注释掉

    //         listen-on-v6port 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     { localhost; };允许查询的客户端的IP,默认为本机,注释掉。

     

               recursionyes; 是否开启迭代查询功能

     

              dnssec-enable yes;

              dnssec-validationyes;

              dnssec-lookasideauto;

     

              /* Path to ISC DLVkey */

              bindkeys-file"/etc/named.iscdlv.key";

     

              managed-keys-directory"/var/named/dynamic";

    };

     

    logging {

            channel default_debug{

                    file"data/named.run";

                    severitydynamic;

            };

    };

     

    //这里必须注释掉原来的file,重新加上file

    zone "." IN {

              type hint;

    //        file"named.ca";

              file"/dev/null";

    };

     

    include "/etc/named.rfc1912.zones";

    include "/etc/named.root.key";

     

     

    2.2.2 配置正反向解析Zone

     

    修改Zone 文件:/etc/named.rfc1912.zones, 添加正向解析和反向解析的Zone 定义。

     

    --配置正向解析Zone

    zone"cndba.cn" IN {    

            typemaster;

            file"cndba.cn.zone";

            allow-update{ none; };

    };

     

    --配置反向解析Zone

    zone"56.168.192.in-addr.arpa" IN {

            typemaster;

            file"56.168.192.local";

            allow-update{ none; };

    };

     

    这里需要注意的是,反向解析从左到右读取ip地址时是以相反的方向解释的,所以需要将ip地址反向排列。这里,192.168.56.*网段的反向解析域名为"56.168.192.in-addr.arpa”。

     

     

    2.2.3 配置正向解析的区域文件

     

              在之前的name.conf 配置中指定的区域文件目录是:/var/named。 所以在这个目录里创建正向解析的区域文件。

     

    文件名就是在Zone中定义的file名。

     

    [root@davedns ~]# touch /var/named/cndba.cn.zone

     

     

    添加如下内容:

    $TTL    86400

    @      IN     SOA dns.cndba.cn.  root.cndba.cn. (

                                            42              ; serial (d.adams)

                                            3H              ; refresh

                                            15M             ; retry

                                            1W              ; expiry

                                             1D)            ; minimum

          IN      NS      dns.cndba.cn.

    dns    IN      A      192.168.56.200

    gns   IN      A       192.168.56.201

    $ORIGINcndba.cn.

    @       IN     NS      gns.cndba.cn.

     

     

    2.2.4 配置反向解析的区域文件

     

    在/var/named 目录下创建反向解析的区域文件,文件名也是之前在Zone中定义的:56.168.192.local。

     

    [root@davedns~]# touch /var/named/56.168.192.local

     

    添加如下内容:

     

    $TTL    86400

    @               IN SOA  dns.cndba.cn.      root.cndba.cn. (

                                          1997022700 ; Serial

                                          28800      ; Refresh

                                           14400      ; Retry

                                          3600000    ; Expire

                                           86400)    ; Minimum

           IN      NS     dns.cndba.cn.

    200     IN     PTR     dns.cndba.cn.

    201     IN     PTR     gns.cndba.cn.

     

     

    2.2.5 重启DNS

    [root@davedns~]# chkconfig named on

     

    [root@davedns~]# service named restart

    Stoppingnamed: .                                         [  OK  ]

    Startingnamed:                                           [  OK  ]

    [root@rac2named]#

     

     

    2.2.6 验证DNS

    在所有节点的/etc/resolv.conf文件中添加如下内容:

     

    [root@rac1~]# cat /etc/resolv.conf

    #Generated by NetworkManager

    nameserver192.168.56.200

    nameserver192.168.56.201

    optionsrotate 

    optionstimeout:2 

    optionsattempts:5 

     

    [root@rac1~]#

    [root@rac2~]# nslookup dns.cndba.cn

    Server:       192.168.56.200

    Address:   192.168.56.200#53

     

    Name:  dns.cndba.cn

    Address:192.168.56.200

     

    [root@rac2~]# nslookup gns.cndba.cn

    Server:       192.168.56.200

    Address:   192.168.56.200#53

     

    Name:  gns.cndba.cn

    Address:192.168.56.201

     

    [root@rac2~]#

     

    [root@rac1~]# nslookup gns.cndba.cn

    Server:       192.168.56.200

    Address:   192.168.56.200#53

     

    Name:  gns.cndba.cn

    Address:192.168.56.201

     

    [root@rac1~]# nslookup dns.cndba.cn

    Server:       192.168.56.200

    Address:   192.168.56.200#53

     

    Name:  dns.cndba.cn

    Address:192.168.56.200

     

    [root@rac1~]#

     

     

    3   安装配置DHCP

     

    3.1             安装DHCP

    [root@davedns~]# yum install dhcp

     

    [root@davedns~]# rpm -qa | grep "^dhcp"

    dhcp-common-4.1.1-43.P1.el6.centos.x86_64

    dhcp-4.1.1-43.P1.el6.centos.x86_64

     

     

    3.2             配置DHCP

     

    [root@davedns~]# vim /etc/dhcp/dhcpd.conf 
    :r /usr/share/doc/dhcp*/dhcpd.conf.sample        --可以导入配置文件在修改。

     

    也可以直接添加如下内容:

     

     

    [root@davednsdhcp]# cat dhcpd.conf

    #

    # DHCPServer Configuration file.

    #   see /usr/share/doc/dhcp*/dhcpd.conf.sample

    #   see 'man 5 dhcpd.conf'

     

    ddns-update-styleinterim;

    ignoreclient-updates;

     

    subnet192.168.56.0 netmask 255.255.255.0 {

     

            option routers                  192.168.56.1;

            option subnet-mask              255.255.255.0;

     

            option nis-domain               "cndba.cn";

            option domain-name              "cndba.cn";

            option domain-name-servers      192.168.56.200;

     

            option time-offset              -18000; # Eastern Standard Time

     

            range dynamic-bootp 192.168.56.100192.168.56.150;

            default-lease-time 21600;

            max-lease-time 43200;

    }

     

    [root@davednsdhcp]#

     

     

    3.3             重启DHCP

     

    [root@davednsdhcp]# chkconfig dhcpd on

     

    [root@davednsdhcp]# chkconfig dhcpd --list

    dhcpd             0:off  1:off  2:on   3:on   4:on   5:on   6:off

     

    [root@davednsdhcp]# service dhcpd restart

    Shuttingdown dhcpd:                                       [  OK  ]

    Startingdhcpd:                                           [  OK  ]

    [root@davednsdhcp]#

     

     

     

    4   安装RAC

    12cRAC 安装的详细步骤参考如下链接:

    Oracle12c RAC 搭建手册

    http://www.cndba.cn/Dave/article/767

     

     

    我们这里贴出不同的地方。

     

    修改hosts文件,注释掉vip的配置,由程序动态获取。

     

    [root@rac2~]# cat /etc/hosts

    127.0.0.1   localhost

     

    192.168.56.5rac1

    192.168.57.5rac1-priv

    #192.168.56.7rac1-vip

     

    192.168.56.6rac2

    192.168.57.6rac2-priv

    #192.168.56.8rac2-vip

     

    #192.168.56.9rac-scan

     

    [root@rac2~]#

     








     

    5   验证

     

    [grid@rac1grid]$ crs_stat -t

    Name           Type           Target    State    Host       

    ------------------------------------------------------------

    ora....SM.lsnrora....er.type ONLINE    ONLINE    rac1       

    ora....ER.lsnrora....er.type ONLINE    ONLINE    rac1       

    ora....AF.lsnrora....er.type OFFLINE   OFFLINE              

    ora....N1.lsnrora....er.type ONLINE    ONLINE    rac2       

    ora....N2.lsnrora....er.type ONLINE    ONLINE    rac1       

    ora....N3.lsnrora....er.type ONLINE    ONLINE    rac1       

    ora.MGMTLSNR   ora....nr.type ONLINE    ONLINE   rac1       

    ora.OCR.dg     ora....up.type ONLINE    ONLINE   rac1       

    ora.asm        ora.asm.type   ONLINE   ONLINE    rac1       

    ora.cvu        ora.cvu.type   ONLINE   ONLINE    rac1       

    ora.gns        ora.gns.type   ONLINE   ONLINE    rac1       

    ora.gns.vip    ora....ip.type ONLINE    ONLINE   rac1       

    ora.mgmtdb     ora....db.type ONLINE    ONLINE   rac1       

    ora....networkora....rk.type ONLINE    ONLINE    rac1       

    ora.oc4j       ora.oc4j.type  ONLINE   ONLINE    rac1       

    ora.ons        ora.ons.type   ONLINE   ONLINE    rac1       

    ora....C1.lsnrapplication    ONLINE    ONLINE   rac1       

    ora.rac1.ons   application    ONLINE   ONLINE    rac1       

    ora.rac1.vip   ora....t1.type ONLINE    ONLINE   rac1       

    ora....C2.lsnrapplication    ONLINE    ONLINE   rac2       

    ora.rac2.ons   application    ONLINE   ONLINE    rac2       

    ora.rac2.vip   ora....t1.type ONLINE    ONLINE   rac2       

    ora.scan1.vip  ora....ip.type ONLINE    ONLINE   rac2       

    ora.scan2.vip  ora....ip.type ONLINE    ONLINE   rac1       

    ora.scan3.vip  ora....ip.type ONLINE    ONLINE   rac1       

    [grid@rac1grid]$

     

    [grid@rac1grid]$ crsctl stat res -t

    --------------------------------------------------------------------------------

    Name           Target  State       Server                   Statedetails      

    --------------------------------------------------------------------------------

    LocalResources

    --------------------------------------------------------------------------------

    ora.ASMNET1LSNR_ASM.lsnr

                   ONLINE  ONLINE      rac1                     STABLE

                   ONLINE  ONLINE      rac2                     STABLE

    ora.LISTENER.lsnr

                   ONLINE  ONLINE      rac1                     STABLE

                   ONLINE  ONLINE      rac2                     STABLE

    ora.OCR.dg

                   ONLINE  ONLINE      rac1                     STABLE

                   ONLINE  ONLINE      rac2                     STABLE

    ora.net1.network

                   ONLINE  ONLINE      rac1                     STABLE

                   ONLINE  ONLINE      rac2                     STABLE

    ora.ons

                   ONLINE  ONLINE      rac1                     STABLE

                   ONLINE  ONLINE      rac2                     STABLE

    --------------------------------------------------------------------------------

    ClusterResources

    --------------------------------------------------------------------------------

    ora.LISTENER_SCAN1.lsnr

          1        ONLINE ONLINE       rac2                     STABLE

    ora.LISTENER_SCAN2.lsnr

          1        ONLINE ONLINE       rac1                     STABLE

    ora.LISTENER_SCAN3.lsnr

          1        ONLINE ONLINE       rac1                     STABLE

    ora.MGMTLSNR

          1       ONLINE  ONLINE       rac1                     169.254.236.113 192.

                                                                168.57.5,STABLE

    ora.asm

          1       ONLINE  ONLINE       rac1                     Started,STABLE

          2       ONLINE  ONLINE       rac2                     Started,STABLE

          3       OFFLINE OFFLINE                               STABLE

    ora.cvu

          1       ONLINE  ONLINE       rac1                     STABLE

    ora.gns

          1       ONLINE  ONLINE       rac1                     STABLE

    ora.gns.vip

          1       ONLINE  ONLINE       rac1                     STABLE

    ora.mgmtdb

          1       ONLINE  ONLINE       rac1                     Open,STABLE

    ora.oc4j

          1       ONLINE  ONLINE       rac1                     STABLE

    ora.rac1.vip

          1        ONLINE ONLINE       rac1                     STABLE

    ora.rac2.vip

          1        ONLINE ONLINE       rac2                     STABLE

    ora.scan1.vip

          1        ONLINE ONLINE       rac2                     STABLE

    ora.scan2.vip

          1        ONLINE ONLINE       rac1                     STABLE

    ora.scan3.vip

          1        ONLINE ONLINE       rac1                     STABLE

    --------------------------------------------------------------------------------

    [grid@rac1grid]$

     

     

    [grid@rac1grid]$ srvctl config scan

    SCANname: scan.cndba.cn, Network: 1

    SubnetIPv4: 192.168.56.0/255.255.255.0/eth0, dhcp

    SubnetIPv6:

    SCAN 0IPv4 VIP: -/scan1-vip/192.168.56.101

    SCANVIP is enabled.

    SCANVIP is individually enabled on nodes:

    SCANVIP is individually disabled on nodes:

    SCAN 1IPv4 VIP: -/scan2-vip/192.168.56.102

    SCANVIP is enabled.

    SCANVIP is individually enabled on nodes:

    SCANVIP is individually disabled on nodes:

    SCAN 2IPv4 VIP: -/scan3-vip/192.168.56.103

    SCANVIP is enabled.

    SCANVIP is individually enabled on nodes:

    SCANVIP is individually disabled on nodes:

    [grid@rac1grid]$

     

    注意这里的IP地址,是从DHCP里自动获取的。

     

     

    [grid@rac1grid]$ srvctl config vip -node rac1

    VIPexists: network number 1, hosting node rac1

    VIPIPv4 Address: -/rac1-vip/192.168.56.100

    VIPIPv6 Address:

    VIP isenabled.

    VIP isindividually enabled on nodes:

    VIP isindividually disabled on nodes:

     

    [grid@rac1grid]$ srvctl config vip -node rac2

    VIPexists: network number 1, hosting node rac2

    VIPIPv4 Address: -/rac2-vip/192.168.56.104

    VIPIPv6 Address:

    VIP isenabled.

    VIP isindividually enabled on nodes:

    VIP isindividually disabled on nodes:

    [grid@rac1grid]$

     

    这里,vip也是一样,自动获取。

     

     

     

     

     

    --------------------------------------------------------------------------------------------

    版权所有,文章禁止转载,否则追究法律责任!

     

    About Dave:

    --------------------------------------------------------------------------------------------

    QQ:492913789

    Email:ahdba@qq.com

    Blog:  http://www.cndba.cn/dave

    Weibo:    http://weibo.com/tianlesoftware

    Twitter:  http://twitter.com/tianlesoftware

    Facebook: http://www.facebook.com/tianlesoftware

    Linkedin: http://cn.linkedin.com/in/tianlesoftware

     

    Dave 的QQ群:

    --------------------------------------------------------------------------------------------

    注意:加群必须注明表空间和数据文件关系 | 不要重复加群

    CNDBA_1:62697850 (空)    CNDBA_2: 62697716 (满)   CNDBA_3: 283816689

    CNDBA_4:391125754   CNDBA_5: 104207940    CNDBA_6:62697977   CNDBA_7: 142216823(满)

    展开全文
  • Oracle Database - Enterprise Edition - Version 11.2.0.1 and later Information in this document applies to any platform. Purpose The Grid Naming Service (GNS) is a new feature in the 1

    Applies to:

    Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
    Information in this document applies to any platform.

    Purpose

    The Grid Naming Service (GNS) is a new feature in the 11.2 Grid Infrastructure (GI). Its design is to simplify the management of the network configuration of the Real Application Cluster (RAC). When GNS is used, it eliminates the manual allocation of the Node and Single Client Access Name (SCAN) Virtual Internet Protocol (VIP) addresses. It also eliminates the need to configure VIP names and SCAN names in a Domain Name Server (DNS) as GNS provides the name resolution for the cluster. What this means is the GNS is configured as a delegated authority in DNS for the Cluster Nodes.


    1. Allocate one static IP address on public network for the GNS VIP.
    2. Setup GNS as a delegate for the cluster's sub-domain on the DNS server.
    3. Validate that there is a DHCP server that is addressable by the cluster nodes.

    When installing GI, there are 2 options:

    1. Configure GNS and let it handle name resolution in the cluster subdomain.
    2. Choose not to configure GNS and configure each Node and SCAN name with IP addresses defined in DNS

    This note does not address option (2) as it is intended to cover how to setup the DNS servers and DHCP servers to work with GNS.

    Please refer to following for more info:

    Oracle® Grid Infrastructure
    Installation Guide

    Checking the Network Requirements


    This article is an example of how to configure DNS to delegate a sub-domain to GNS. It also covers how DHCP is to be configured to allocate IP address for SCAN and Node VIP addresses.

    Example below should be limited to an isolated test Lab. It should be set up by the Network Administrator, as it covers the configuration of the DNS server and DHCP server. This note does not cover the configuration of any of the cluster nodes.

    Scope

    This document is intended for Network Administrator, Oracle Clusterware/RAC Database Administrators and Oracle support engineers. 

    Details

    DNS Setup Example

    The example below is based on bind-9.3.4-10 on Linux though the setting should be generic for bind.
    In this example, the GNS VIP is gns.us.eot.com with IP120.0.0.200. The GNS subdomain is us.eot.com.

    Main config /etc/named.conf:

    options {
            directory "/etc/named";
            zone-statistics yes;
            allow-transfer {"none";};
    };

    controls {
            inet 127.0.0.1 allow { localhost; } keys { rndc; };
    };

    key rndc {
            algorithm hmac-md5;
            secret "tpyCbBuiElAdZMfkirg3RcrCtyql0kW42vT24LxXysM=";
    };

    zone "." {
            type hint;
            file "root";
    };

    zone "0.0.127.in-addr.arpa" {
            type master;
            file "127.0.0";
            notify no;
    };

    zone "eot.com" {
            type master;
            file "eot.com";
            notify no;
    };

    zone "0.0.120.in-addr.arpa" {
            type master;
            file "120.0.0";
            notify no;
    };

    The main config is for a single forward domain eot.com and reverse domain for subnet 120.0.0.0

    eot.com zone config file under /etc/named as defined in named.conf file above:

    $TTL 3D
    
    @       IN      SOA     eot.com. root.eot.com. (
    
                            199609206       ; serial, todays date + todays serial #
                            8H              ; refresh, seconds
                            2H              ; retry, seconds
                            4W              ; expire, seconds
                            1D )            ; minimum, seconds
                    NS      eot.com.
                    MX      10 eot.com.  ; Primary Mail Exchanger
                    TXT     "EOT Domain"
    localhost       A       127.0.0.1
    eot.com.        A       120.0.0.254
    dns             CNAME   eot.com.
    
    $ORIGIN         us.eot.com.
    @       IN      NS     gns.us.eot.com.
    
    gns.us.eot.com.    IN      A      120.0.0.200
    

    Above setting will delegate resolution of sub-domain us.eot.com to GNS VIP 120.0.0.200.

     

    To verify delegation

    To verify delegation is working as expected, execute the following nslookup and both should resolve to same set of IP addresses once GI is up and running: 

    nslookup <scan-name> <main-DNS-IP>
    nslookup <scan-name> <GNS-IP>

     For example: 

    nslookup scan.us.eot.com 120.0.0.254
    nslookup scan.us.eot.com 120.0.0.200

      

    DHCP Server Setup Example

    The example below is based on dhcp-3.0.5 on Linux:
    /etc/dhcp/dhcp.conf

    ddns-update-style interim;
    ignore client-updates;

    subnet 120.0.0.0 netmask 255.255.255.0 {

      range 120.0.0.201 120.0.0.220;
      default-lease-time 86400;
      option routers 120.0.0.1;
      option ip-forwarding off;
      option broadcast-address 120.0.0.255;
      option subnet-mask 255.255.255.0;
      option time-offset              -28800;
      option ntp-servers 120.0.0.254;
      option domain-name              "us.eot.com";
      option domain-name-servers 120.0.0.254;
    }

    The DHCP will provide dynamic IPs for client in the range of 120.0.0.201-120.0.0.220 with subnet mask of 255.255.255.0, the default lease time is 86400 seconds, timezone -28800 which is PST (GMT-8), with default gateway of 120.0.0.1 and default ntp and DNS server of 120.0.0.254

    Note: When using 3rd party DHCP server, the DHCP server must support "Client Identifier" for GNS to work. For example, for Lucent DHCP Server, the option name is "SupportClientId". Please consult with the DHCP Server provider to confirm if this feature is available and how to enable it. However thisdoes not apply to the Linux DHCP server as example above.

    Without this feature, DHCP server will not allocate IP to a client which does not have a valid MAC address. As VIP and SCAN VIP are designed to failover, they will not have MAC address assigned. When Oracle request IP for these VIPs from the DHCP server, we only supply the Client Identifier, not the MAC address in the client request.

    A tcpdump of the DHCP packet will show:
    ******************
    15:59:09.165705  In 00:10:e0:3a:2c:56 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 414: vlan 2100, p 0, ethertype IPv4, (tos 0x0, ttl  64, id 0, offset 0, flags [DF] , proto: UDP (17), length: 396) 120.0.0.10.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:00:00:00:00:00, length 368, xid 0x89b5e43f, Flags [Broadcast]
             Client-Ethernet-Address 00:00:00:00:00:00
             sname "racnode1-vip"
             Vendor-rfc1048 Extensions
               Magic Cookie 0x63825363
               DHCP-Message Option 53, length 1: Discover
               MSZ Option 57, length 2: 8
               Client-ID Option 61, length 12: "racnode1-vip"
    ******************

    The 3rd party DHCP server will report error:  "Oct  7 15:59:09 packet has an invalid hardware address" if it does not have support "Client Identifier" feature enabled.

     

    Validate DHCP Server from cluvfy

    To verify whether client can get IP from DHCP server, as root:

    # <GRID_HOME>/bin/cluvfy comp dhcp -clustername clu202

    Verifying DHCP Check
    Checking if any DHCP server exists on the network...
    At least one DHCP server exists on the network and is listening on port 67
    Checking if DHCP server has sufficient free IP addresses for all VIPs...
    DHCP server was able to provide sufficient number of IP addresses
    The DHCP server response time is within acceptable limits

    Verification of DHCP Check was successful.

    The verbose output looks like this:
    # <GRID_HOME>/bin/cluvfy comp dhcp -clustername clu202 -verbose

    Verifying DHCP Check
    Checking if any DHCP server exists on the network...
    Checking if network CRS resource is configured and online
    Network CRS resource is offline or not configured. Proceeding with DHCP checks.
    CRS-10009: DHCP server returned server: 120.0.0.200, loan address : 120.0.0.250/255.255.255.0, lease time: 86400

    At least one DHCP server exists on the network and is listening on port 67
    Checking if DHCP server has sufficient free IP addresses for all VIPs...
    Sending DHCP "DISCOVER" packets for client ID "clu202-scan1-vip"
    CRS-10009: DHCP server returned server: 120.0.0.254, loan address : 120.0.0.250/255.255.255.0, lease time: 86400

    Sending DHCP "REQUEST" packets for client ID "clu202-scan1-vip"
    CRS-10009: DHCP server returned server: 120.0.0.254, loan address : 120.0.0.250/255.255.255.0, lease time: 86400

    Sending DHCP "DISCOVER" packets for client ID "clu202-scan2-vip"
    CRS-10009: DHCP server returned server: 120.0.0.254, loan address : 120.0.0.249/255.255.255.0, lease time: 86400

    Sending DHCP "REQUEST" packets for client ID "clu202-scan2-vip"
    CRS-10009: DHCP server returned server: 120.0.0.254, loan address : 120.0.0.249/255.255.255.0, lease time: 86400

    Sending DHCP "DISCOVER" packets for client ID "clu202-scan3-vip"
    CRS-10009: DHCP server returned server: 120.0.0.254, loan address : 120.0.0.248/255.255.255.0, lease time: 86400

    Sending DHCP "REQUEST" packets for client ID "clu202-scan3-vip"
    CRS-10009: DHCP server returned server: 120.0.0.254, loan address : 120.0.0.248/255.255.255.0, lease time: 86400

    Sending DHCP "DISCOVER" packets for client ID "clu202-racnode1-vip"
    CRS-10009: DHCP server returned server: 120.0.0.254, loan address :120.0.0.247/255.255.255.0, lease time: 86400

    Sending DHCP "REQUEST" packets for client ID "clu202-racnode1-vip"
    CRS-10009: DHCP server returned server: 120.0.0.254, loan address :120.0.0.247/255.255.255.0, lease time: 86400

    CRS-10012: released DHCP server lease for client ID clu202-scan1-vip on port 67

    CRS-10012: released DHCP server lease for client ID clu202-scan2-vip on port 67

    CRS-10012: released DHCP server lease for client ID clu202-scan3-vip on port 67

    CRS-10012: released DHCP server lease for client ID clu202-racnode1-vip on port 67

    DHCP server was able to provide sufficient number of IP addresses
    The DHCP server response time is within acceptable limits

    Verification of DHCP Check was successful.


    Note: "cluvfy comp dhcp" is supported in 11.2.0.2 and above, to get latest CVU, go to http://otn.oracle.com

    * If above command is not executed as root, the following error will be reported:

    PRVF-0055 : User "grid" does not have sufficient authorization to run this command


    * If the following error is reported, refer to note 1316815.1

    PRVF-4037 : CRS is not installed on any of the nodes
    Verification cannot proceed


    * If it fails to get IP from DHCP server, engage System Administrator or Network Administrator to verify DHCP server setup

    Verifying DHCP Check
    Checking if any DHCP server exists on the network...

    PRVF-5801 : Failed to execute command "/ocw/grid/bin/crsctl discover dhcp -clientid giclu-scan0-vip" on all nodes
    PRVF-5704 : No DHCP server were discovered on the public network listening on port 67

    Verification of DHCP Check was unsuccessful on all the specified nodes.

    crsctl discover dhcp -clientid giclu-scan0-vip
    CRS-10010: unable to discover DHCP server in the network listening on port 67 for client ID giclu-scan0-vip
    CRS-4000: Command discover failed, or completed with errors.

    Agent may not get an IP address if DHCP runs on one of the cluster node, this is fixed inbug 14638061 which is included in 12.1.0.2

    Validating DHCP Server on OS level

    Testing DHCP could potentially change local network config and cause connection lost, engage System Administrator if you have any doubt. All commands need to be executed as root.

    Solaris

    Assuming e1000g0 is on public network, the following can be executed to test whether OS is able to get IP from DHCP server

    # ifconifg e1000g0:9                  #### to confirm e1000g0:9 is unused; if it's used, try a different alias
    ifconfig: status: SIOCGLIFFLAGS: e1000g0:9: no such interface    #### output confirms e1000g0:9 is not being used
    # ifconfig e1000g0:9 plumb
    # ifconfg e1000g0:9 dhcp start
    # ifconfig e1000g0:9
    e1000g0:9: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
           inet 10.11.25.202 netmask fffffe00 broadcast 10.11.25.255
    # ifconfig e1000g0:9 down
    # ifconfig e1000g0:9 unplumb

     

    AIX

    # smitty dhcpcd

    For details, please consult System Administrator

    Linux

    Assuming eth0 is on public network and eth0:9 is unused (ifconfig output should not have eth0:9, try a different one if eth0:9 is used), create /etc/sysconfig/network-scripts/ifcfg-eth0:9 with the following:

    DEVICE=eth0:9
    BOOTPROTO=dhcp


    To start eth0:9:

    # cp -p /etc/resolv.conf /etc/resolv.conf.dhcporig    #### backup the file as dhcp client may modify it
    # /sbin/ifup eth0:9
    Determining IP information for eth0:9... failed.    #### failed to get IP from DHCP server

    Determining IP information for eth0:9... done.  #### succeeded to get IP from DHCP server


    To stop eth0:9:

    # ifconfig eth0:9 down
    # ps -ef| grep eth0:9| grep -v grep

    root      7930     1  0 17:48 ?        00:00:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-eth0:9.leases -pf /var/run/dhclient-eth3:11.pid eth3:11
    # kill -9 <pid-of-above-dhclient>
    # cp -p /etc/resolv.conf.dhcporig /etc/resolv.conf
       #### backup the file as dhcp client may modify it


    Once the testing is done, remove /etc/sysconfig/network-scripts/ifcfg-eth0:9

    展开全文
  • Oracle RAC 集群 SCAN 说明

    万次阅读 2017-12-01 13:32:18
    1 SCAN 概述 之前有网友在我Blog 留言说我的RAC 搭建中没有写SCAN 配置,这个之前应该是有写过,但刚搜了一下,没找到,正好重新整理一下,并做下实验,实验就用Oracle 12c 进行测试。 在Oracle 11g 之前,我们去...


     

     

    1   SCAN 概述

    之前有网友在我Blog 留言说我的RAC 搭建中没有写SCAN 配置,这个之前应该是有写过,但刚搜了一下,没找到,正好重新整理一下,并做下实验,实验就用Oracle 12c 进行测试。

     

    在Oracle 11g 之前,我们去连接RAC 集群,都是配置如下的内容:

    dave_rac=

    (DESCRIPTION =

     (ADDRESS_LIST =

     (LOAD_BALANCE = yes)

      (FAILOVER=ON)

     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.68)(PORT = 1521))

     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.69)(PORT = 1521))

     )

     (CONNECT_DATA =

      (SERVICE_NAME = dave)

      (failover_mode=(type=select)(method=basic))

        )

      )

     

    这里的68和69 是VIP 的地址,是PUBLIC 网卡上的虚拟IP。 那我们这里只有2个节点,如果我们增加了RAC的集群数,那么就需要修改所有的客户端的配置,这个就很麻烦。

     

    所以在Oracle 11gR2 中,引入了SCAN(Single ClientAccess Name)的特性。SCAN是一个域名,可以解析至少1个IP,最多解析3个SCAN IP,客户端可以通过这个SCAN 名字来访问数据库,另外SCAN ip必须与public ip和VIP在一个子网。

     

    启用SCAN 之后,会在数据库与客户端之间,添加了一层虚拟的服务层,就是SCAN IP和SCAN IP Listener,在客户端仅需要配置SCAN IP的tns信息,通过SCANIP Listener,连接后台集群数据库。这样,不论集群数据库是否有添加或者删除节点的操作,均不会对客户端产生影响,也就不需要修改配置。

     

    配置SCAN有3种方法:


    1.  使用/etc/hosts文件

    这个是我们目前用的最多的方式,但是缺点只能对应一个SCAN IP,该方法Oracle 不推荐,但是简单,不需要单独的DNS 服务器,使用该方法,客户端还是需要VIP来链接。 Oracle 推荐使用其他的2种方法来实现SCAN 功能。

     

    2.  在DNS中定义域名,只需要在DNS中配置即可实现SCAN 功能。

     

     

    3.  通过Grid Naming Server(GNS),需要配置DNS 和DHCP才能实现SCAN 功能。

       

     

     

    配置好之后,直接在客户端的tnsnames里写SCAN NAME就可以了,如下:

    RACSCAN =

     (DESCRIPTION =

       (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan.gns.cndba.com)(PORT = 1521))

       (CONNECT_DATA =

         (SERVER = DEDICATED)

                (SERVICE_NAME = dave)

        )

      )

     

    以后RAC 增加删除节点,客户端都不需要修改。

     

     

    2   SCAN 工作流程

    在启用SCAN 特性之后,除了多几个SCAN IP 之外,还会多几个SCAN IP Listener,每个SCAN IP对应一个SCAN IP Listener,为了性能考虑,每个SCAN IP以及其对应的SCAN IP Listener将被独立的分配到各个节点上。

     

    如果Cluster中其中某个运行SCAN IP的节点出现异常,则其余正常的SCAN IP节点将自动接管。

     

    如果客户端是11g R2的版本,则客户端只需在tns中配置域名解析,即可实现failover,如果客户端版本低于11g R2,则无法通过域名解析出多个SCAN IP地址,因此如果要实现failover,必须在客户端的tns中配置3个SCAN IP的地址进行解析,这也是为何Oracle强烈建议在使用11g R2数据库时,客户端也最好使用11g R2的原因。

     

     

     

     

     

    上图是SCAN 的工作流程图,图的右边是一个4个节点的RAC 集群,所以有4个Local Listener。 配置了3个SCAN IP和3个 SCAN Listeners。这3个SCAN IP 是随机的落在RAC节点上。

     

        客户端链接的时候,会随机的连接到某一个某一个SCAN IP及起对应的SCAN IP Listner上, SCAN IP Listener接收到连接请求时,会根据 LBA 算法(least loaded instance),将该客户端的连接请求,转发给对应的Instance上的VIP Listener,从而完成了整个客户端与服务器的连接过程。

     

    简单点就是:

    client -> scan listener -> locallistener -> local instance

     

    3   SCAN 相关的几个名词说明

     

     

    3.1             SCAN VIP

     

    SCAN VIP,即SCAN IP,是由DNS或者GNS、hosts解析出来的IP地址。目前SCANVIP最多能有三个,它们循环地被客户端所请求到。

     

    SCAN VIP数量和节点数没有关系,正如上图所示,4个节点,3个SCAN VIP,SCAN VIP是随机的落在哪个节点上的,这个过程也是动态变化的。

     

    3.2             GNS VIP

    GNS VIP同SCAN VIP, GNS VIP是提供GNS服务的IP地址,它绑定到某个节点的PUBLIC IP所在网卡上,当节点出现故障,GNS资源会自动切换到其他正常的节点继续提供GNS解析服务。如果我们不使用GNS解析方法,那么也不会存在GNS VIP。

     

    3.3             SCAN LISTENER

    SCAN监听器,实现SCAN的负载均衡功能。如果RAC上有三个SCAN VIP,那么SCAN监听器也有三个,它们各自监听SCAN VIP的连接请求。

     

    SCAN监听器的注册是由REMOTE_LISTENER参数控制的,任何实例都会向所有的SCAN监听器注册,所以SCAN LISTENER 会包含所有实例的名称。

     

    这样SCAN监听器可以实时了解所有实例的运行情况的,因此能够准确地将连接重定向到空闲服务器的本地监听器上。

     

    SCAN监听器是跟着SCAN VIP随机分配到节点服务器上,如果某个节点发生故障,运行在此节点上的SCANVIP会进行漂移,这时候SCAN监听器也跟着漂移到正常的节点上,继续为SCAN VIP监听连接请求,当PMON进程下次动态更新实例信息到该SCAN监听器之后,它又重新接受客户端的连接。

     

    3.4             REMOTE_LISTENER

    Oracle 参数,设置该参数之后,任何实例都会向SCAN监听器注册,所以SCAN监听器能够负载均衡地分发连接请求到节点本地监听器上。

     

        因为SCAN IP有多个,他们对应的是同一个域名,因此在数据库中,需要使用easyconnect naming method方式,需要修改sqlnet.ora的配置文件添加ezconnect,如:

    NAMES.DIRECTORY_PATH=(tnsnames,ezconnect)。

     

     

        设置格式:REMOTE_LISTENER=SCAN:PORT,如REMOTE_LISTENER=rac-scan.cndba.cn:1521。

     

    配置之后,RAC数据库的每个节点的PMON进程,会用广播的方式向每个SCAN Listener进行注册,同时CRS的后台进程ONS,会采集各个节点的负载状况,通知SCAN Listener,以便SCAN Listener根据负载情况,将新连接分配到当前负载最低的节点上。

     

     

    管理理论部分,就这么多,接下来,会整理2篇Oracle 12c 环境下使用DNS和GNS 实现SCAN 的Blog,具体的了解下如何实现这种功能。

     

     

    参考:

    Grid Infrastructure Single ClientAccess Name (SCAN) Explained (文档 ID 887522.1)

     

     

     

     

     

    --------------------------------------------------------------------------------------------

    版权所有,文章禁止转载,否则追究法律责任!

     

    AboutDave:

    --------------------------------------------------------------------------------------------

    QQ:492913789

    Email:ahdba@qq.com

    Blog:  http://www.cndba.cn/dave

    Weibo:    http://weibo.com/tianlesoftware

    Twitter:  http://twitter.com/tianlesoftware

    Facebook: http://www.facebook.com/tianlesoftware

    Linkedin: http://cn.linkedin.com/in/tianlesoftware

     

    Dave 的QQ群:

    --------------------------------------------------------------------------------------------

    注意:加群必须注明表空间和数据文件关系 | 不要重复加群

    CNDBA_1: 62697850 (空)    CNDBA_2: 62697716 (满)   CNDBA_3: 283816689

    CNDBA_4: 391125754   CNDBA_5: 104207940    CNDBA_6: 62697977   CNDBA_7: 142216823(满)

    展开全文
  • Oracle 11gR2 RAC 进程说明

    万次阅读 2017-12-01 12:58:09
      一. 先看Oracle 官方文档   参考: ... Oracle Clusterware Software Concepts and Requirements Oracle Clusterware uses voting disk files to provide fencin
  • 双节点rhel5_x64_11gr2_grid_asm 安装文档

    千次阅读 2012-11-22 11:26:47
    一、 安装环境 主机操作系统:win7  虚拟机软件:vmware workstation8 ...DNS 服务器操作系统:windows server 2003  Oracle Database software : Oracle11gr2  Cluster software : Oracle grid inf
  • RAC linux配置域名解析服务

    千次阅读 2013-11-27 14:08:42
    Oracle 11gR2引入SCAN之后,SCAN的...Oracle提供两种方法解析SCAN,一种是传统的DNS解析,另一种是Oracle提供的GNS解析。不管用哪种方法解析都需要配置DNS。下面对这两种解析方式的DNS配置进行讨论,使用DNS解析SCAN用
  • 对scan ip的理解

    千次阅读 2013-11-19 15:43:27
    这些天做11g的RAC实验,才发现oracle 11g的scan ip这个概念,当时在安装的时候,直接在host文件中加入了一条scan对应的解析,之后安装成功。之后才在网上搜了很多资料,自认为对scan ip有了一定的认识,只是身边每个...
  • Oracle 11G RAC 体系结构概述

    千次阅读 2015-01-17 16:25:06
    Oracle 11G RAC体系结构: RAC环境与单实例最主要的区别是 RAC的每个实例都有属于自己的SGA、后台进程。由于数据文件、控制文件共享于所有实例,所以必须放在共享存储中。联机重做日志文件:只有一个实例可以写入,...
  • ORACLE RAC体系结构图

    千次阅读 2017-12-16 21:58:41
     Oracle 11G RAC体系结构: RAC环境与单实例最主要的区别是 RAC的每个实例都有属于自己的SGA、后台进程。 由于数据文件、控制文件共享于所有实例,所以必须放在共享存储中。 联机重做日志文件:只有一...
  • Oracle 11g R2 RAC高可用连接特性 – SCAN详解 By luocs ( 十月 23, 2012 at 下午 4:43) · Filed under Oracle高可用(RAC、ASM、DATAGUARD), DNS, GNS, oracle, rac, SCAN 昨天帮朋友解决11g RAC ...
  • ASM的磁盘组无法挂载解决办法

    千次阅读 2016-05-21 23:57:20
    Installing Oracle RAC 11.2.0.3, OEL 6.3 and Virtualbox 4.2 with GNS Contents Linux, Virtualbox Installation Check OS setting DNS Setup including BIND, NTP, DHCP in a LAN on a sep
  • Oracle 11g R2(11.2.0.4.0)+udev搭建RAC

    千次阅读 2017-10-16 14:12:32
    准备工作:硬件配置要求1 . 确定操作系统平台,64bit or 32bit。 查看系统平台# uname -m2 . 安装GI至少 1.5gb内存;安装GI和RAC数据库至少2.5GB内存 查看物理内存大小:# grep MemTotal /proc/meminfo3 ....
  • scan ip的理解

    千次阅读 2017-08-14 09:39:07
    这些天做11g的RAC实验,才发现oracle 11g的scan ip这个概念,当时在安装的时候,直接在host文件中加入了一条scan对应的解析,之后安装成功。之后才在网上搜了很多资料,自认为对scan ip有了一定的认识,只是身边每个...
  • RAC 11.2的新特性

    千次阅读 2011-10-08 22:41:16
    网格即插即用(GPnP)    网格即插即用帮助管理员来维护集群,以前增加或删除节点需要的一些手动操作的步骤现在可以由GPnP来自动实现。  GPnP不是一个单独的概念,它依赖于以下特性:在一个XML配置文件中储存...
  • Oracle 在RAC中使用DNSDHCP

    千次阅读 2015-07-31 11:17:30
    通常,我们在搭建RAC的时候,习惯把相关的IP配置在每个节点上的/etc/hosts文件当中。然而在12c当中,虽然也可以把相关的IP同样...在安装Flex Cluster的时候,要求配置GNS,同时也就汲到了DHCP。其实,这些要求是合理的
1 2 3 4 5 ... 13
收藏数 253
精华内容 101
关键字:

dns+dhcp+gns oracle