Hadoop单节点安装

  • 官网地址
    https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/SingleCluster.html#Standalone_Operation
  • 安装前准备
    1.linux机器,安装见
    https://www.jianshu.com/p/f5276f319faa
    2.java jdk
    hadoop版本和jdk对应版本
    https://cwiki.apache.org/confluence/display/HADOOP/Hadoop+Java+Versions
    2020-11-21_234946.jpg

    选择安装hadoop3.2.1,所以选择java8版本
    https://pan.baidu.com/s/1Z_7o8jt9claDawzf6C8bjg
    提取码:c9ss
    上传到linux服务器 解压:
[root@localhost jdk]# tar -xvf jdk-8u144-linux-x64.tar.gz

配置环境变量

[root@localhost jdk1.8.0_144]# vim /etc/profile
#追加内容
export JAVA_HOME=/opt/jdk/jdk1.8.0_144
export PATH=$JAVA_HOME/bin:$PATH
#生效
[root@localhost jdk1.8.0_144]# source /etc/profile
#验证
[root@localhost jdk1.8.0_144]# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

3.hadoop3.2.1
https://mirror.bit.edu.cn/apache/hadoop/common/hadoop-3.2.1/hadoop-3.2.1.tar.gz
上传到linux服务器 解压:

[root@localhost hadoop-3.2.1]# tar -xvf hadoop-3.2.1.tar.gz
#指定java路径
[root@localhost hadoop]# vim /opt/hadoop/hadoop-3.2.1/etc/hadoop/hadoop-env.sh
#添加
export JAVA_HOME=/opt/jdk/jdk1.8.0_144
[root@localhost hadoop]# vim /opt/hadoop/hadoop-3.2.1/etc/hadoop/mapred-env.sh
#添加
export JAVA_HOME=/opt/jdk/jdk1.8.0_144
[root@localhost hadoop]# vim /opt/hadoop/hadoop-3.2.1/etc/hadoop/yarn-env.sh 
#添加
export JAVA_HOME=/opt/jdk/jdk1.8.0_144
#配置hadoop环境变量
export JAVA_HOME=/opt/jdk/jdk1.8.0_144
export HADOOP_HOME=/opt/hadoop/hadoop-3.2.1
export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH

4.简单操作

将符合某个正则表达式的文件复制到某个文件夹

  $ mkdir input
  $ cp etc/hadoop/*.xml input
  $ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.1.jar grep input output 'dfs[a-z.]+'
  $ cat output/*

你可能感兴趣的:(Hadoop单节点安装)