• hadoop 2.4 伪分布式模式


    1.core-site.xml

    在<configuration></configuration>中插入

         <property>
                <name>fs.default.name</name>
                <value>hdfs://localhost:9000</value>
         </property>
    
         <property>
                 <name>dfs.replication</name>
                 <value>1</value>
         </property>
    
         <property>
                  <name>hadoop.tmp.dir</name>
                  <value>/home/你自己的用户名/tmp</value>
         </property>
    
     

    2.mapred-site.xml

    在<configuration></configuration>中插入

    <property>
         <name>mapred.job.tracker</name>
         <value>localhost:9001</value>
    </property>

    3.首次运行hadoop必须进行格式化Hadoop文件系统。

    进入安装了Hadoop的文件路径下,然后在命令行输入 

    bin/hadoop  namenode -format

     

    4.启动Hadoop,在命令行里面输入

    bin/start-all.sh

    This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh

     

    bash start-dfs.sh (需要配置export JAVA_HOME)

    bash start-yarn.sh

     

    jps

    http://localhost:50070 (dfshealth)

    http://localhost:8088 (Cluster Metrics)

     

    5.运行wordcount示例

    1).创建文件

    /home/guan/myword.txt

    2).创建hadoop目录

    ./bin/hadoop fs -mkdir /input

    3).上传文件

     ./bin/hadoop fs -put -f /home/guan/myword.txt /input

    4).执行

    ./bin/hadoop jar./share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.4.1-sources.jarorg.apache.hadoop.examples.WordCount /input /output

    5).查看结果

    ./bin/hadoop fs -cat /output/part-r-00000  

  • 相关阅读:
    基数排序
    定时任务
    线程池的创建
    SharePoint 客户端对象模型 多选查阅项赋值
    Sharepoint Rest 根据user获取UserId
    SHAREPOINT
    plupload 实例
    JS 在web页面中调用本地应用程序
    Jquery ajax上传文件到服务器
    sharepoint 人员选择控件使用
  • 原文地址:https://www.cnblogs.com/yuyutianxia/p/4020308.html
Copyright © 2020-2023  润新知