背景:
阅读新闻
正式生产环境下Hadoop集群的DNS+NFS+SSH免密码登陆配置
[日期:2014-06-07] 来源:Linux社区 作者:weir2008 [字体:]
环境虚拟机CentOS6.5
主机名h1 IP 192.168.137.11 作为DNS FNS的服务器
主机名h2 IP 192.168.137.12
主机名h3 IP 192.168.137.13
建立DNS(为了取代集群修改hosts带来的大量重复工作)
--------------------------------------分割线 --------------------------------------
Ubuntu 12.10 +Hadoop 1.2.1版本集群配置
--------------------------------------分割线 --------------------------------------
1.安装DNS在h1上面
检查命令:
rpm –q bind
rpm -q bind-chroot
安装命令:
yum -y install bind bind-chroot
2. 修改/etc/named.conf
主要修改这两个地方注意红色修改的部分
listen-on port 53 { any;};
allow-query { any; };
文件全内容:
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISCBIND named(8) DNS
// server as a caching only nameserver (as a localhostDNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example namedconfiguration files.
//
options {
listen-onport 53 { any; };
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 { any; };
recursionyes;
dnssec-enableyes;
dnssec-validationyes;
dnssec-lookasideauto;
/* Path toISC DLV key */
bindkeys-file"/etc/named.iscdlv.key";
managed-keys-directory"/var/named/dynamic";
};
logging {
channeldefault_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file"named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
3. 修改/etc/named.rfc1912.zones
正反配置红色部分
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zonesrecommended by
// RFC 1912 section 4.1 : localhost TLDs and addresszones
// and
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example namedconfiguration files.
//
zone "localhost.localdomain" IN {
type master;
file"named.localhost";
allow-update{ none; };
};
zone "localhost" IN {
type master;
file"named.localhost";
allow-update{ none; };
};
zone"1.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.loopback";
allow-update{ none; };
};
zone "1.0.0.127.in-addr.arpa" IN {
type master;
file"named.loopback";
allow-update{ none; };
};
zone "0.in-addr.arpa" IN {
type master;
file"named.empty";
allow-update{ none; };
};
zone "linuxidc.com" IN {
type master;
file "linuxidc.com.zone";
allow-update { none; };
};
zone "137.168.192.in-addr.arpa" IN {
type master;
file"137.168.192.in-addr.zone";
allow-update{ none; };
};
4.在/var/named目录下创建linuxidc.com.zone和137.168.192.in-addr.zon文件(这里很重要每个地方都要看清楚怎么设置)
这里是将named.localhost 拷贝之后做的修改
cp -p named.localhost linuxidc.com.zone
cp -p named.localhost 137.168.192.in-addr.zone
linuxidc.com.zone文件内容:
$TTL 86400
@ IN SOA h1.linuxidc.com. chizk. (
0 ; serial (d.adams)
1D ; refresh
1H ; retry
1W ; expiry
3H ) ; minimum
@ IN NS h1.linuxidc.com.
h1.linuxidc.com. IN A 192.168.137.11
h2.linuxidc.com. IN A 192.168.137.12
h3.linuxidc.com. IN A 192.168.137.13
h4.linuxidc.com. IN A 192.168.137.14
h5.linuxidc.com. IN A 192.168.137.15
h6.linuxidc.com. IN A 192.168.137.16
137.168.192.in-addr.zone文件内容:
$TTL 86400
@ IN SOA h1.linuxidc.com. chizk. (
0 ; serial (d.adams)
1D ; refresh
1H ; retry
1W ; expiry
3H ) ; minimum
@ IN NS h1.linuxidc.com.
11 IN PTR h1.linuxidc.com.
12 IN PTR h2.linuxidc.com.
13 IN PTR h3.linuxidc.com.
14 IN PTR h4.linuxidc.com.
15 IN PTR h5.linuxidc.com.
16 IN PTR h6.linuxidc.com.
修改正向文件和反向文件属组
[root@h1 named]# chgrp named linuxidc.com.rev
[root@h1 named]# chgrp named linuxidc.com.zone
5. 添加DNS域名服务器ip(这里注意修改/etc/resolv.conf是没用的,重启电脑就失效了)
先说h1电脑,因为是DNS服务器所以我没有配置这一项 ,这里可能与我的网络连接有关系
下面说其他节点都如下配置:
这里需要找到/etc/sysconfig/network-scripts/ifcfg-eth0
主要是加入DNS1=192.168.137.11
完整内容:
DEVICE=eth0
TYPE=Ethernet
UUID=5a32d5ab-af65-44bc-9d21-c757fb44add3
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.137.12
PREFIX=16
GATEWAY=192.168.137.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=08:00:27:17:25:7F
LAST_CONNECT=1402057925
DNS1=192.168.137.11
6.启动DNS(防火墙关闭)
service named start
自动开启:
查看:chkconfig –listnamed
设置启动级别:chkconfig --level 123456 named on