2台虚拟机。使用CentOS6.8。网络使用NAT模式。
vi /etc/sysconfig/network
修改HOSTNAME
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.101
PREFIX=24
GATEWAY=192.168.1.2
DNS1=192.168.1.2
NAME=eth0
vi /etc/udev/rule.d/70-persistent-net.rules
如果有两个eth,删除eth0,把eth1改为eth0
vi /etc/hosts
末尾增加
192.168.1.101 hadoop01
192.168.1.102 hadoop02
192.168.1.103 hadoop03
Windows在C:\Windows\System32\drivers\etc\hosts下同样配置
service iptables stop
chkconfig iptables off
mkdir /opt/module /opt/software
克隆完后需修改主机名并重配网络。
ssh-keygen -t rsa
ssh-copy-id hadoop01
ssh-copy-id hadoop02
ssh-copy-id hadoop03
rsync -rvl 源文件 root@主机名:/目的文件
关闭所有节点的ntpd
service ntpd stop
chkconfig ntpd off
时间服务器节点vi /etc/ntp.conf
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap去掉#
以下内容加上#
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
末尾添加
server 127.127.1.0
fudge 127.127.1.0 stratum 10
时间服务器节点vi /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
时间服务器节点开启ttp服务
service ntpd start
chkconfig ntpd on
其余从机每10分钟时间同步
crontab -e
*/10 * * * * /usr/sbin/ntpdate hadoop01