系统:centos 6.10
jdk:jdk-8u281-linux-x64.tar.gz
hadoop: hadoop-2.10.1.tar.gz
http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.10.1/
1、jdk和hadoop安装包复制解压到服务器,配置环境变量
cd /root
vim .bashrc
export JAVA_HOME=/root/hd/jdk1.8.0_281
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
export HADOOP_HOME=/root/hd/hadoop-2.10.1
export PATH=$HADOOP_HOME/bin:$PATH
修改完环境变量执行:
source .bashrc
使用命令查看是否配置OK:
java -version
,hadoop version
2、修改Hadoop配置文件
cd /root/hd/hadoop-2.10.1/etc/hadoop
2.1、
vim core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://192.168.2.11:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/root/hd/hadoop-2.10.1/tmp</value>
</property>
<property>
<name>hadoop.native.lib</name>
<value>false</value>
<description>Should native hadoop libraries, if present, be used.</description>
</property>
</configuration>
2.2、
vim hadoop-env.sh
2.3、
vim hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.secondary.http.address</name>
<value>192.168.2.11:50090</value>
</property>
</configuration>
2.4、
cp mapred-site.xml.template mapred-site.xml
,vim mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
2.5、
vim yarn-site.xml
<property>
<name>yarn.resourcemanager.hostname</name>
<value>192.168.2.11</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
3、启动Hadoop
3.1、格式化hadoop文件
cd /root/hd/hadoop-2.10.1/sbin
,hadoop namenode -format
3.2、启动服务
./start-all.sh
,中途会让输几次密码
3.3、查看服务是否启动
jps
访问:
http://192.168.2.11:50070/