正式生产环境下Hadoop集群的DNS+NFS+SSH免密码登陆配置
环境虚拟机CentOS6.5
主机名h1 IP 192.168.137.11 作为DNS FNS的服务器
主机名h2 IP 192.168.137.12
主机名h3 IP 192.168.137.13
建立DNS(为了取代集群修改hosts带来的大量重复工作)
--------------------------------------分割线 --------------------------------------
--------------------------------------分割线 --------------------------------------
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
// andhttp://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (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; };
};
type master;
allow-update { none; };
};
zone "137.168.192.in-addr.arpa" IN {
type master;
file"137.168.192.in-addr.zone";
allow-update{ none; };
};
这里是将named.localhost 拷贝之后做的修改
cp -p named.localhost 137.168.192.in-addr.zone
$TTL 86400
0 ; serial (d.adams)
1D ; refresh
1H ; retry
1W ; expiry
3H ) ; minimum
137.168.192.in-addr.zone文件内容:
$TTL 86400
0 ; serial (d.adams)
1D ; refresh
1H ; retry
1W ; expiry
3H ) ; minimum
修改正向文件和反向文件属组
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