Hadoop集群配置
准备工作
配置主机名
修改每台服务器上的/etc/hosts文件,添加主机名配置。
master
slave1
slave2
slave3
安装JDK
创建运行Hadoop程序的用户
在系统中添加运行Hadoop程序的用户hadoop,并修改其登录密码为hadoop。
[******@bgu0004 ~]# useradd hadoop
[******@bgu0004 ~]# passwd hadoop
Changing password for user hadoop.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated essfully.
配置SSH无密钥验证配置
为了实现无口令SSH登录,需要在主机上配置公私密钥方式登录。此时需要通过root帐号登录,修改每个主机上的/etc/ssh/sshd_config文件,去掉RSAAuthentication yes和PubkeyAuthentication yes前面的“#”。
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys
,在每台主机上运行ssh-keygen -t rsa命令生成本地的公私密钥对。
[******@bgu0001 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
Created directory '/home/hadoop/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/.
The key fingerprint is:
2f:da:4d:f3:00:e2:c3:87:19:b0:50:fe:43:47:08:a7 ******@bgu0001
同样的过程需要在3台slave主机上执行。然后通过scp命令将3台slave主机的公钥拷贝到master主机上。
[******@bgu0002 ~]$ scp .ssh/ master:/home/hadoop/.ssh/
The authenticity of host 'master ()' can't be established.
RSA key fingerprint is 72:cd:14:f2:a2:d1:f0:e3:9e:a0:db:93:e7:5e:68:ee.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'master,' (RSA) to the list of known hosts.
******@master's password:
100% 396 00:00
:
[******@bgu0001 ~]$ cd .ssh/
[******@bgu0001 .ssh]$ ls
id_rsa
,是用户hadoop在master主机上的公钥;、。
[******@bgu0001 .ssh]$ cat
Hadoop集群配置 来自淘豆网m.daumloan.com转载请标明出处.