Martins Blog

Trying to explain complex things in simple terms

Build your own 11.2 RAC system-part I: DNS

Posted by Martin Bach on September 26, 2009

As many of you already know, Oracle released 11g Release 2 of the database for Linux x86 and x86-64. That is really cool and this time I don’t want to miss out on researching some new features of the new release. I have spent some time reading up about 11.2 and for what it’s worth I’d consider it more of a step forward compared to 11.1 which IMO is just a glorified 10.2.0.4 with a lot of cost options. But I disgress….

The reason of this post is to allow the reader to set up his own DNS server for building an 11.2 RAC system. As you may know, 11.2 uses DNS for two main purposes:

  1. Grid Plug and Play
  2. Single Client Access Name (SCAN)

Grid Plug and Play is something I’ll look at later so let’s focus on the SCAN addresses. The documentation states that we should at least provide 3 IP addresses for a single SCAN name which will be used in a round robin fashion (reference: Section 2.7.2.2 IP Address Requirements for Manual Configuration in the Grid Infrastructure Installation Guide for Linux).

Huh? Are the DBAs now tasked with DNS administration? Probably not, but it doesn’t hurt understanding the concepts, especially if you are like me and want a RAC cluster in your lab environment.

DNS and Linux

I initially looked at DNS when still at the University which seems like a long time ago nowadays. Back then Linux was the uni’s preferred non-Windows platform so I knew which package to install. The following example uses bind 9.3.4-6P1.el5 which is the unpatched DNS server distributed with RHEL 5 update 2.

A word of caution: this article shouldn’t be used to set up a production DNS server, it’s merely intended to get you a DNS server for a lab environment!

With all that said, let’s proceed to getting our SCAN addresses registered. First of all, use rpm to install the package.

Once that’s installed, we need to configure our DNS server. bind9 comes with a number of sample configuration files which make our life a little easier. Traditionally, bind is configured in 2 places:

  • /etc/named.conf for the zone definition and
  • /var/named for the zone configuration.

/etc/named.conf

Let’s look at /etc/named.conf first. Please check the documentation and/or man page for the file if you need more explanation.

This file contains the zones as recommended by RFC 1912 section 4.1 (part of the sample configuration) and my zone “the-playground.de”. I want to resolve all hostnames ending in the-playground.de from the DNS server. Consider this file:

options
{
 /* make named use port 53 for the source of all queries, to allow
 * firewalls to block all ports except 53:
 query-source    port 53;
 query-source-v6 port 53;
 */

 // Put files that named is allowed to write in the data/ directory:
 directory "/var/named"; // the default
 dump-file               "data/cache_dump.db";
 statistics-file         "data/named_stats.txt";
 memstatistics-file      "data/named_mem_stats.txt";

 allow-transfer {"none";};
 zone-statistics yes;

};

logging
{
 channel default_debug {
 file "data/named.run";
 severity dynamic;
 };
};

zone "the-playground.de" IN {
 type master;
 file "the-playground.zone";
 //allow-transfer {192.168.30.2;};
 notify no;
};

zone "30.168.192.in-addr.arpa" IN {
 type master;
 file "the-playground.reverse";
 //allow-update { none; };
 //allow-transfer {192.168.30.2;};
 notify no;
};

// the following is recommended and not my stuff
// named.rfc1912.zones:

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; };
};

The file is a copy & paste effort with emphasis of getting it to work rather than a beautiful engineering effort. Copy the files referenced by the file directive from /usr/share/doc/bind-9.3.4/sample/var/named to /var/named. The files “the-playground.reverse” and “the-playground.zone” need to be created, see below. Please also rename the zones to whatever you fancy. If you wonder why there are 2 directives for the same domain – that has to do with forward and reverse address resolution. DNS needs to be able to do 2 things:

  1. Resolve name to IP address
  2. Reverse the process, converting IP addresses to names.

So when you type in “ping node1.the-playground.de” DNS will translate this to “ping 192.168.30.10″. Also, you can ask DNS which hostname is behind a specific IP using the nslookup tool. dig and host are some more tools you could use for troubleshooting.

the-playground.zone

The file has the following contents:

$TTL    86400
@        IN SOA    the-playground.de hostmaster.the-playground.de (
                 42        ; serial (d. adams)
                 3H        ; refresh
                15M        ; retry
                 1W        ; expiry
               1D )        ; minimum
                IN NS   node1
node1           IN A    192.168.30.10
node1v          IN A    192.168.30.11
node2           IN A    192.168.30.20
node2v          IN A    192.168.30.21
node3           IN A    192.168.30.30
node3v          IN A    192.168.30.31

scan-cluster    IN A    192.168.30.100
scan-cluster    IN A    192.168.30.101
scan-cluster    IN A    192.168.30.102

Here we are assigning names to IP addresses. The reverse is done in the reverse zone file. Just change names and IP addresses to fit your needs.

NOTE
I had an undetected problem with the file, in a way that the PTR wasn’t the FQDN of the host which caused reverse lookups to return incorrect results. This has now been fixed.

the-playground.reverse

Consider this file:

$TTL    86400
@        IN SOA    the-playground.de root.rhel5.the-playground.de (
                   42        ; serial (d. adams)
                   3H        ; refresh
                  15M        ; retry
                   1W        ; expiry
                 1D )        ; minimum
                IN NS   node1.the-playground.de.
10              IN PTR  node1.the-playground.de.
11              IN PTR  node1v.the-playground.de.
20              IN PTR  node2.the-playground.de.
21              IN PTR  node2v.the-playground.de.
30              IN PTR  node3.the-playground.de.
31              IN PTR  node3v.the-playground.de.

100             IN PTR  scan-cluster.the-playground.de.
101             IN PTR  scan-cluster.the-playground.de.
102             IN PTR  scan-cluster.the-playground.de.

Starting and using named

With the files in place, start named using service named start. Check /var/log/messages for potential problems (usually typos) and correct them. Configuration changes are made available through service named reload.

Edit /etc/resolv.conf on your RAC nodes, they need the following entries:

options attempts: 2
options timeout: 1

search          the-playground.de
nameserver      192.168.30.10

Change IP addresses for your environment. Also, edit /etc/nsswitch conf’s hosts directive to favour dns over files, i.e. make sure the line beginning “hosts” reads hosts: dns files

That’s it! We’re well underway to set up our first 11.2 cluster!

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 2,417 other followers

%d bloggers like this: