hadoop在CentOS下的安装配置
Posted 马小强
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hadoop在CentOS下的安装配置相关的知识,希望对你有一定的参考价值。
- 版本:CentOS-6.8-x86_64-minimal,hadoop2.6.4,jdk1.7.0
- 首先把jdk、hadoop压缩包下载发送到CentOS下并解压
下载发送不多赘述,解压命令tar -zxvf 压缩包
mv 原文件名 新文件名
(注意空格)
- 先配置jdk
- 进入jdk目录 pwd 查看当前目录复制备用/apps/jdk1.7.0_25
- 配置环境变量
vi ~/.bash_profile
JAVA_HOME=/apps/jdk1.7.0_25
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
source ~/.bash_profile
- 关闭防火墙,做好ssh免密登录
- 关闭防火墙
- service iptables stop
- chkconfig iptables off
- ssh-keygen -t rsa
- ssh免密登录
- master: cat /root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys
- master:scp /root/.ssh/authorized_keys @slave1:/root/.ssh/authorized_keys
- slave1:cat /root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys
- slave1:scp /root/.ssh/authorized_keys @slave2:/root/.ssh/authorized_keys
- slave2:cat /root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys
- slave2:scp /root/.ssh/authorized_keys @master:/root/.ssh/authorized_keys
- master:scp /root/.ssh/authorized_keys @slave1:/root/.ssh/authorized_keys
- slave2:scp /root/.ssh/authorized_keys @slave2:/root/.ssh/authorized_keys
- 关闭防火墙
- 再配置hadoop
- 环境变量vi ~/.bash_profile
HADOOP_HOME=/apps/hadoop-2.6.4
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbinsource ~/.bash_profile
- 配置运行环境
- core-site.xml
-
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
-
- hdfs-site.xml
-
<property>
<name>dfs.replication</name>
<value>3</value>
</property><property>
<name>dfs.namenode.name.dir</name>
<value>/app/hadoop/dfs/name</value>
</property><property>
<name>dfs.datanode.data.dir</name>
<value>/app/hadoop/dfs/data</value>
</property><property>
<name>dfs.secondary.http.address</name>
<value>slave2:50090</value>
</property><property>
<name>dfs.namenode.checkpoint.dir</name>
<value>/app/hadoop/dfs/namesecondary</value>
</property>
-
- hadoop-env.sh
- export JAVA_HOME=/apps/jdk1.7.0_25
- yarn-site.xml
-
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property><property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
</property>
mapreduce-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
-
- core-site.xml
- 将配置完成的jdk、hadoop发送到另外两台主机上
- master:scp -r apps/ @slave1:/apps/
- master:scp -r apps/ @slave2:/apps/
hadoop集群配置完成
以上是关于hadoop在CentOS下的安装配置的主要内容,如果未能解决你的问题,请参考以下文章
在CentOS上安装Hadoop集群-- Centos系统配置