10.51.82.35 node35 10.51.82.36 node36 10.51.82.37 node37 10.51.82.38 node38 10.51.82.39 node39 10.51.82.40 node40 10.51.82.41 node41
保存退出,重启机器查看主机名是否变化 [root@node29 ~]#
2.5. ssh免登陆配置
2.5.1.
创建公钥和密钥
[root@node29 ~]# ssh-keygen -t rsa Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is:
b9:ef:52:0d:94:42:fa:13:f7:ea:bb:ce:34:50:07:5f root@node29 The key's randomart image is: +--[ RSA 2048]----+ | .. .. E | | .. oo . |
| . .oo o | | . =.o | | S o. | | +... | | ..+ | | .= . | | +Oo | +-----------------+ [root@node29 ~]# [root@node29 .ssh]# pwd /root/.ssh
[root@node29 .ssh]# cat id_rsa.pub >> authorized_keys [root@node29 .ssh]# cd ..
[root@node29 ~]# chmod -R 700 .ssh/ [root@node29 ~]# cd .ssh/
[root@node29 .ssh]# chmod 644 authorized_keys [root@node29 .ssh]# ssh node29
The authenticity of host 'node29 (10.51.82.29)' can't be established. RSA key fingerprint is be:77:86:0c:7e:76:b8:f4:b8:5d:e4:ed:e0:50:14:b5. Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node29,10.51.82.29' (RSA) to the list of known hosts.
Last login: Tue Jul 29 19:46:49 2014 from 10.51.5.179 此时自身已经可以ssh,
2.5.2. 配置与其他机器的免密码登陆
[root@node29 .ssh]# pwd /root/.ssh
[root@node29 .ssh]# ssh-copy-id -i id_rsa.pub root@node138
[root@node30 ~]# chmod -R 700 /root/.ssh/
[root@node30 ~]# chmod 644 /root/.ssh/authorized_keys
重新在29上查看ssh 30成功 [root@node29 .ssh]# ssh node30
Last login: Tue Jul 29 19:48:34 2014 from 10.51.5.179 [root@node30 ~]#
其他datanode同理,需要各个机器之间都可以通过ssh免密码登陆。
2.6. 同步集群时间ntp
ntp服务端设为10.231.220.13
集群时区和时间需要保持完全一致,相差最多不要超过15S,否则将导致集群运行出现问题。可以考虑使用时间同步软件,此处手动同步集群时间:
10.48.3.192
[root@node29 ~]# date -s 21:21:40 date -s 20141229
同步到硬件时钟
[root@node29 ~]# hwclock –w
2.6.1. 配置ntp server集群时钟
1、node13 配置:vi /etc/ntp.conf driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 restrict -6 ::1
restrict 10.231.220.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 1 includefile /etc/ntp/crypto/pw keys /etc/ntp/keys
[root@node29 etc]# service ntpd start 正在启动 ntpd:[确定] 设置开机自动启动:
[root@node29 etc]# chkconfig ntpd on 查看状态: