+ All Categories
Home > Documents > [email protected] DNS HA A multimaster DNS configuration for Disaster Recovery and...

[email protected] DNS HA A multimaster DNS configuration for Disaster Recovery and...

Date post: 26-Dec-2015
Category:
Upload: dinah-tyler
View: 223 times
Download: 0 times
Share this document with a friend
Popular Tags:
21
[email protected] DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment
Transcript
Page 1: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

[email protected]

DNS HAA multimaster DNS configuration for Disaster

Recovery and Business Continuity environment

Page 2: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 2

HA DNS General Concepts

It is a fundamental component of a Disaster Recovery strategy

Objectives: – Build a resilient DNS infrastructure able to guarantee the

full functionality in case of “Disaster” in any of the INFN Computing centers.

– The system should be able to modify the IP of a service also during the “down time” of a site hosting one of the authoritative DNS servers for the “INFN.IT” Domain.

– In general INFN national services addresses are of this type: <ServiceName>.INFN.IT

17/04/2013

Page 3: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 3

Current INFN DNS infrastructure

INFN.IT Domain

dxcnaf.cnaf.infn.itAXFR

server2.infn.it

ns1.garr.net ext-dns-2.cern.ch

AXFRAXFR

Primary name server for infn.it Domain

17/04/2013

Page 4: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 4

DNS HA Architecture (single master)

infn.it

dxcnaf.cnaf.infn.it

AXFRserver2.infn.it

ha.infn.it

ns1.ha.infn.it

AXFR

host IN CNAME host.ha.infn.it.

host 60 IN A 193.x.y.zhost 60 IN A 131.154.a.b

nagios-srv

host.cnaf.infn.it

host.lnf.infn.it

probe

probe

update

ha IN NS ns1.ha.infn.itns1.ha.infn.it 131.154.48.100

17/04/2013

Page 5: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 5

HA DNS Architecture (Single Master implementation)

• National Services (host.infn.it) are geographically replicated in 2 sites for Example: CNAF in Bologna and LNF (Frascati National Laboratories) in Frascati

• The ha.infn.it sub domain defined in a name server ns1.ha.infn.it placed in a third site geographically far from the two sites hosting the National Services. – A DNS delegation is set up on server2.infn.it (infn.it primary DNS) defining

ns1.ha.infn.it as the primary NS for the ha.infn.it domain. The host names of the HA Services are registered in server2.infn.it as CNAME pointing to the ha.infn.it domain entries.

• The host name defined in ns1.ha.infn.it points to the IP address of one of the instances of the service with TTL 60

• A nagios server (Installed for example in the site hosting ns1.ha.infn.it) probes the different servers implementing the service instances. – If the main server doesn’t answer to the probe, nagios triggers the nsupdate

procedure on ns1.ha.infn.it in order to point to the active instance of the service.

• Using the same CNAME defined in server2.infn.it the service will always be reached in the site where it is Up and Running.

17/04/2013

Page 6: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 6

DNS HA architecture(multimaster)

Riccardo Veraldi

infn.it

dxcnaf.cnaf.infn.itAXFR server2.infn.it

ha.infn.it

ns1.ha.infn.it

ha IN NS ns1.ha.infn.itha IN NS ns2.ha.infn.itns1.ha.infn.it 131.154.48.100ns2.ha.infn.it 131.154.48.101host IN CNAME host.ha.infn.it.

nagios-srv

host.cnaf.infn.it

host.lnf.infn.it

probe

probe

ha.infn.it

Master instance at INFN ROMA1

Master instance at CNAF

ns2.ha.infn.it

host 60 IN A 193.x.y.zhost 60 IN A 131.154.a.b

nsupdate

nsup

date

17/04/2013

Page 7: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 7

HA DNS multimaster

• National Services (host.infn.it) are geographically replicated in 2 sites for Example: CNAF in Bologna and LNF (Frascati National Laboratories) in Frascati

• The ha.infn.it sub domain is now implemented with a Multimaster architecture in two different INFN department for example CNAF and INFN ROMA1– A DNS delegation is set up on server2.infn.it (infn.it primary DNS) defining

ns1.ha.infn.it and ns2.ha.infn.it as NS for the ha.infn.it domain. The host names of the HA services are registered in server2.infn.it as CNAME pointing to the hostnames defined in ha.infn.it domain.

• The host names defined in ns1.ha.infn.it and ns2.ha.infn.it point to the IP address of one of the instances of the service with TTL 60.

• A nagios server (Installed in the site hosting ns2.ha.infn.it) probes the different servers implementing the service instances. – If the main server doesn’t answer to the probe, nagios triggers the update

procedure to modify the IP address in ns2.ha.infn.it or in ns1.ha.infn.it if the first is not reachable in order to point to the active instance of the service.

• Using the same CNAME defined in server2.infn.it the service will always be reachable in the site where it is Up and Running.

17/04/2013

Page 8: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 8

BIND9 limits

• BIND9 – reads DNS data from text files. It is very easy to make a mistake when

editing a file causing it to be mis-read or made un-readable by BIND– stores all DNS data in RAM. If your DNS server is authoritative for a

large number of zones, you may have to rebuild the kernel on your machine in order to support BIND's memory needs

– parses all of its zone files at startup. For a large number of zones this can be time-consuming

– If you change any information in those zone files, you must reload or restart BIND before those changes take effect. “Do this often enough and BIND could spend more time reloading data than answering queries!”

– does not support multi-master architecture

17/04/2013

Page 9: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 9

BIND-DLZ

• BIND-DLZ is a patch for BIND9– It allows you to store your zone data in a database

• PostgreSQL• MySQL• Berkeley DB• ODBC• LDAP

or• FS hierarchical structure

– Changes in your database are immediately reflected in BIND's response to DNS queries, no need to restart named when DNS info changes

– Il dynamically load zones when needed– Very flexible: you can have standard BIND zones and DLZ zones

configured in named.conf

17/04/2013

Page 10: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 10

BIND-DLZ + MySQL

ha.infn.it ha.infn.itCNAF ROMA1

mysql mysql

ns1.ha.infn.it ns2.ha.infn.it

bind-dlz bind-dlz

MySQL circular replicationmaster1/slave2 master2/slave1

17/04/2013

Page 11: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 11

CentOS + BIND-DLZ

• CentOS 6.4– bind-sdb-9.8.2-0.17.rc1.el6 (yum install bind-sdb)– mysql-server-5.1.67-1.el6

• Centos 5.x– it works but bind src.rpm from el6 must be re-built on el5

bind from el5 rpm does not include DLZ extensions

• Any mysql version can be used: tested on 5.0, 5.1, 5.6

17/04/2013

Page 12: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 12

named configuration

• A chrooted version of named is always a suggested best practice: – bind-9.8.2-0.17.rc1.el6_4.4.x86_64– bind-utils-9.8.2-0.17.rc1.el6_4.4.x86_64– bind-libs-9.8.2-0.17.rc1.el6_4.4.x86_64– bind-sdb-9.8.2-0.17.rc1.el6_4.4.x86_64– bind-chroot-9.8.2-0.17.rc1.el6_4.4.x86_64

• DLZ zone in named.conf

dlz "ha.infn.it zone" { database "mysql

{host=127.0.0.1 dbname=named user=named pass=NameD} {select zone from dns_records where zone = '$zone$'} {select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"') else data end from dns_records where zone = '$zone$' and host = '$record$' and not (type = 'SOA' or type = 'NS')} {select ttl, type, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum from dns_records where zone = '$zone$' and (type = 'SOA' or type='NS')} {select ttl, type, host, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum from dns_records where zone = '$zone$' and not (type = 'SOA' or type = 'NS')} {select zone from xfr_table where zone = '$zone$' and client = '$client$'} {update data_count set count = count + 1 where zone ='$zone$'}";};

17/04/2013

Page 13: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 13

MySQL Schema

• DLZ driver does not impose a specific schema, It accepts SQL queries with a few special tokens as parameters. These queries are then parsed and the tokens removed. When a query is run, the token is replaced with the appropriate value. This allows a variety of database schemas to be used without modification to the driver's code– Limitations:

• The query must return the appropriate data types in the correct order.

• The query must use the correct pre-defined tokens.• Named must not be multi-threaded

17/04/2013

Page 14: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 14

MySQL example schema

+-------------+-----------------------------------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------------+-----------------------------------------+------+-----+---------+-------+| zone | varchar(255) | NO | MUL | NULL | || host | varchar(255) | NO | MUL | NULL | || type | enum('SOA','NS','MX','A','CNAME','PTR') | NO | MUL | NULL | || data | varchar(255) | YES | | NULL | || ttl | int(11) | NO | | NULL | || mx_priority | varchar(10) | YES | | NULL | || refresh | int(11) | YES | | NULL | || retry | int(11) | YES | | NULL | || expire | int(11) | YES | | NULL | || minimum | int(11) | YES | | NULL | || serial | bigint(20) | YES | | NULL | || resp_person | varchar(255) | YES | | NULL | || primary_ns | varchar(255) | YES | | NULL | |+-------------+-----------------------------------------+------+-----+---------+-------+

INDEXES: zone, host, type

17/04/2013

Page 15: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 15

Step1: on MySQL Master1/Slave2

[mysqld]server-id = 1#log-bin=mysql-binbinlog-do-db=namedbinlog-ignore-db=mysqlbinlog-ignore-db=test

• Master 1/Slave 2 ip: 131.154.48.100• Master 2/Slave 1 ip : 131.154.48.101

• Create a replication slave account in mysql

mysql> grant replication slave on *.* to 'replication’@131.154.48.101 \identified by ’*****';

• Restart mysql Master1

17/04/2013

Page 16: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 16

Step2: on MySQL Slave1/Master2

[mysqld]server-id = 2master-host = 131.154.48.100master-user = replicationmaster-password = *******master-port = 3306

• Restart mysql slave1/master2 then start slave processmysql> start slave;mysql> show slave status\G;

• Slave_IO_Running and Slave_SQL_Running must be Yes in the output

17/04/2013

Page 17: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 17

Step3: on MySQL Master1/Slave2

mysql> show master status;+------------------+----------+--------------+------------------+| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |+------------------+----------+--------------+------------------+| mysql-bin.000007 | 5248 | named | mysql,test |+------------------+----------+--------------+------------------+1 row in set (0.00 sec)

This is the simple master-slaves scenario

17/04/2013

Page 18: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 18

Step4: on MySQL Slave1/Master2

[mysqld]#information for becoming masterlog-bin=mysql-binbinlog-do-db=namedbinlog-ignore-db=mysqlbinlog-ignore-db=test

• Configure Slave1 as a master (Master2)

• Create a replication slave account on Slave1/Master2 for Master1

mysql> grant replication slave on *.* to \'replication’@131.154.48.100 identified by ’********';

17/04/2013

Page 19: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 19

Step5: on MySQL Master1/Slave2

• Edit my.cnf on Master1 for information of its master.

[mysqld]#information for becoming slave.master-host = 131.154.48.101master-user = replicationmaster-password = **********master-port = 3306

• Restart both Master1 and Master2

• On Master1mysql> start slave;

17/04/2013

Page 20: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 20

Step6: on MySQL Master1 and Master2

• Checking slave and master status both on Master1 and Master2

mysql> show slave status\G;

mysql> show master status;

• Both MySQL servers are configured as slave/master to each other allowing a circular replication• To Avoid auto incement key clashing

• On Master 1

• On Master2

[mysqld]auto_increment_increment = 2auto_increment_offset = 1

[mysqld]auto_increment_increment = 2auto_increment_offset = 2

17/04/2013

Page 21: Riccardo.Veraldi@cnaf.infn.it DNS HA A multimaster DNS configuration for Disaster Recovery and Business Continuity environment.

Riccardo Veraldi - Spring HEPiX 2013 21

conclusions

• With the introduction of a new domain ha.infn.it with two nameservers (multimaster) installed in different sites with the correct CNAME configuration and delegation on the top level domain nameserver is possible to build a DNS architecture for Geographically redundant services.

• The Multimaster implementation permits to change the ip addresses even if one of the two sites hosting the DNS service is down.– The technologies used in this implementation of the

multimaster DNS is based on Bind9-DLZ + mysql backebd

17/04/2013


Recommended