Hadoop集群安装
1.配置JDK环境和设置主机名,本地解析
JDK环境教程: http://www.cnblogs.com/wangweiwen/p/6104189.html
本地解析:
vim /etc/hostname,给每台机器起一个主机名:
Master.Hadoop
Slave1.Hadoop
Slave2.Hadoop
Slave3.Hadoop
Slave4.Hadoop
![](http://images2015.cnblogs.com/blog/879497/201611/879497-20161126160730081-287864244.png)
vim /etc/hosts
192.168.1.230 localhost
192.168.1.200 Master.Hadoop
192.168.1.201 Slave1.Hadoop
192.168.1.202 Slave2.Hadoop
![](http://images2015.cnblogs.com/blog/879497/201611/879497-20161126160804128-801905761.png)
ping 主机名能得到相应,就说明配置通了
2.集群中互相免密码登录
登录到Master.Hadoop,切换到root用户,然后执行 ssh-keygen -t rsa,无脑一直回车,生产一对公钥密钥,把公钥写入/root/.ssh/authorized_keys文件中,并给authorized_keys文件600权限(chmod 600 authorized_keys)
同样的方法在其他机器上面生产公钥,把公钥写入到Master.Hadoop下面的/root/.ssh/authorized_keys文件中,然后把/root/.ssh/authorized_keys拷贝到每一台从机器上面,保证每一台机器上面都有其他机器的公钥。
测试一下:ssh Master.Hadoop ,能登录说明没问题
3.安装Hadoop
3.1 Hadoop 下载 :http://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz
解压到/use/local,cd /usr/local/hadoop-2.7.3/ && mkdir -p tmp hdfs hdfs/data hdfs/name
3.2 添加从机器的配置文件:在${Hadoop}/etc/hadoop/slaves中,写入所有从机器的主机名,一行一台
![](http://images2015.cnblogs.com/blog/879497/201611/879497-20161126163740956-358561213.png)
3.3 ${Hadoop/etc/hadoop/hadoop-env.sh ,${Hadoop/etc/hadoop/yarn-env.sh 中加入export JAVA_HOME=/usr/local/jdk1.8.0_111/
4 启动Hadoop集群
${Hadoop}/bin/hadoop namenode -format -y
${Hadoop}/sbin/start-dfs.sh
${Hadoop}/sbin/start-yarn.sh
${Hadoop}/sbin/mr-jobhistory-daemon.sh start historyserver
${Hadoop}/sbin/yarn-daemon.sh start proxyserver