Linux环境安装Hadoop单机版

一、安装版本

hadoop-2.7.5

下载地址:Index of /dist/hadoop/core (apache.org)

二、准备工作

1、安装jdk 8及以上版本

2、修改主机名称(可以不修改)

3、关闭防火墙

三、安装

1、解压到/opt目录下

tar -zxvf hadoop-2.7.5.tar.gz -C /opt/

2、配置hadoop环境变量

vim /etc/profile

export HADOOP_HOME=/opt/hadoop-2.7.5

export PATH= P A T H : PATH: PATH:HADOOP_HOME/bin

source /etc/profile

3、配置Haddop

3.1、hadoop-env.sh

vi/opt/hadoop-2.7.5/etc/hadoop/hadoop-env.sh

找到# The java implementation to use.将其下面的一行改为:

#export JAVA_HOME=${JAVA_HOME}

export JAVA_HOME=export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64/j

3.2、配置core-site.xml

vim /opt/hadoop-2.7.5/etc/hadoop/core-site.xml

hadoop.tmp.dir file:///opt/hadoop-2.7.5 Abase for other temporary directories. fs.defaultFS hdfs://master:8888

3.3、配置hdfs-site.xml

vim /opt/hadoop-2.7.5/etc/hadoop/hdfs-site.xml

dfs.replication 1 dfs.namenode.name.dir file:///opt/hadoop-2.7.5/tmp/dfs/name dfs.datanode.data.dir file:///opt/hadoop-2.7.5/tmp/dfs/data

4、启动hadoop

4.1、第一次启动时需要先格式化

cd /opt/hadoop-2.7.5

./bin/hdfs namenode -format

如果遇到

Re-format filesystem in Storage Directory /opt/hadoop-2.7.5/tmp/dfs/name (Y or N)
输入:Y

4.2、启动

./sbin/start-dfs.sh

4.3、停止

./sbin/stop-dfs.sh

4.4、验证

http://localhost:50070

5、配置yarn

5.1、配置mapred-site.xml

cd /opt/hadoop-2.7.5/etc/hadoop/

p mapred-site.xml.template mapred-site.xml

vim mapred-site.xml

mapred.job.tracker master:9001 mapred.local.dir /opt/hadoop-2.7.5/tmp/var mapreduce.framework.name yarn

5.2、配置yarn-site.xml

vim yarn-site.xml

yarn.nodemanager.aux-services mapreduce\_shuffle

5.3、yarn启动与停止

cd /opt/hadoop-2.7.5

./sbin/start-yarn.sh

./sbin/stop-yarn.sh

浏览器查看:http://localhost:8088

jps查看进程

你可能感兴趣的:(java,hadoop,linux,hdfs,eclipse,大数据)