• 安装hadoop伪分布式


    修改hosts
    cat /etc/hosts
    127.0.0.1 mo.don.com
    
    创建用户
    useradd hadoop
    passwd hadoop
    
    sudo授权
    visudo
    hadoop  ALL=(ALL)       NOPASSWD: ALL
    
    切换用户
    su - hadoop
    
    下载解压
    wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-3.1.2/hadoop-3.1.2.tar.gz
    tar xf hadoop-3.1.2.tar.gz
    
    创建工作目录
    mkdir moudles && mv hadoop-3.1.2 moudles
    mkdir -p  moudles/data/{datanode,namenode,tmp}
    cd moudles/hadoop-3.1.2
    
    添加环境变量
    cat /etc/profile
    
    ## add hadoop
    
    export HADOOP_HOME=/home/hadoop/moudles/hadoop-3.1.2
    export PATH=$HADOOP_HOME/bin/:$HADOOP_HOME/sbin:$PATH
    
    修改配置文件
    cat /home/hadoop/moudles/hadoop-3.1.2/etc/hadoop/hadoop-env.sh
    export JAVA_HOME=/usr/local/jdk1.8.0
    
    cat /home/hadoop/moudles/hadoop-3.1.2/etc/hadoop/core-site.xml
    <configuration>
        <!-- HDFS资源路径 -->
        <property>
            <name>fs.defaultFS</name>
            <value>hdfs://mo.do.com:9820</value>
        </property>
        <!-- 在见面界面访问数据使用的用户名 -->
        <property>
            <name>hadoop.http.staticuser.user</name>
            <value>heron</value>
        </property>
        <!-- Hadoop临时文件存放目录 -->
        <property>
            <name>hadoop.tmp.dir</name>
            <value>/home/hadoop/moudles/data/tmp</value>
        </property>
        <!-- 垃圾文件保留时间(秒) -->
        <property>
          <name>fs.trash.interval</name>
          <value>7200</value>
        </property>
    </configuration>
    
    cat /home/hadoop/moudles/hadoop-3.1.2/etc/hadoop/hdfs-site.xml
    <configuration>
        <!-- 是否进行权限检查 -->
        <property>
            <name>dfs.permissions.enabled</name>
            <value>false</value>
        </property>
        <!-- 副本数 -->
        <property>
            <name>dfs.replication</name>
            <value>1</value>
        </property>
            <!-- namenode元数据存储路径 -->
        <property>
            <name>dfs.namenode.name.dir</name>
            <value>/home/hadoop/moudles/data/namenode</value>
        </property>
            <!-- 数据存储路径 -->
        <property>
            <name>dfs.datanode.data.dir</name>
            <value>/home/hadoop/moudles/data/datanode</value>
        </property>
    </configuration>
    
    cat /home/hadoop/moudles/hadoop-3.1.2/etc/hadoop/yarn-site.xml
    <configuration>
        <!-- resourceManager在哪台机器 -->
        <property>
            <name>yarn.resourcemanager.hostname</name>
            <value>mo.do.com</value>
        </property>
        <!-- 在nodemanager中运行mapreduce服务 -->
        <property>
            <name>yarn.nodemanager.aux-services</name>
            <value>mapreduce_shuffle</value>
        </property>
        <!-- 配置日志的聚集功能 -->
        <property>
            <name>yarn.log-aggregation-enable</name>
            <value>true</value>
        </property>
        <property>
            <name>yarn.log-aggregation.retain-seconds</name>
            <value>604800</value>
        </property>
    </configuration>
    
    cat /home/hadoop/moudles/hadoop-3.1.2/etc/hadoop/mapred-site.xml
    
    <configuration>
        <!-- mapreduce运行在yarn上面 -->
        <property>
            <name>mapreduce.framework.name</name>
            <value>yarn</value>
        </property>
        <property>
            <name>yarn.app.mapreduce.am.env</name>
            <value>HADOOP_MAPRED_HOME=/home/hadoop/moudles/hadoop-3.1.2</value>
        </property>
        <property>
            <name>mapreduce.map.env</name>
            <value>HADOOP_MAPRED_HOME=/home/hadoop/moudles/hadoop-3.1.2</value>
        </property>
        <property>
            <name>mapreduce.reduce.env</name>
            <value>HADOOP_MAPRED_HOME=/home/hadoop/moudles/hadoop-3.1.2</value>
        </property>
    </configuration>
    
    格式化hdfs
    hdfs namenode -format
    
    启动hdfs/ Yarn
    hdfs --daemon start namenode
    hdfs --daemon start datanode
    yarn --daemon start resourcemanager
    yarn --daemon start nodemanager
    yarn --daemon start timelineserver
    
    查看启动状态
    jps
    
    浏览器查看

    [http://mo.don.com:8188]:

    赵客缦胡缨,吴钩霜雪明。 银鞍照白马,飒沓如流星。
  • 相关阅读:
    校验规则,纯数字。几位有效数字,保留几位小数
    银行卡校验规则(Luhn算法)
    forEach兼容ie8
    node.js
    gulp
    observer
    webpack.config.js 配置
    内存泄漏(Memory Leak)
    cdn
    前端 各种插件的官网
  • 原文地址:https://www.cnblogs.com/boy215/p/11022611.html
Copyright © 2020-2023  润新知