zoukankan      html  css  js  c++  java
  • 大数据-Hadoop 本地运行模式

    Grep案例

    1. 创建在hadoop-2.7.2文件下面创建一个input文件夹

    [atguigu@hadoop101 hadoop-2.7.2]$ mkdir input

    2. Hadoopxml配置文件复制到input

    [atguigu@hadoop101 hadoop-2.7.2]$ cp etc/hadoop/*.xml input

    3. 执行share目录下的MapReduce程序(执行)

    [atguigu@hadoop101 hadoop-2.7.2]$ bin/hadoop jar

    share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar grep input output 'dfs[a-z.]+'(要正常的运行,必须要保证output删除,没有才能运行)

    4. 查看输出结果

    [atguigu@hadoop101 hadoop-2.7.2]$ cat output/*

    WordCount案例

    1. 创建在hadoop-2.7.2文件下面创建一个wcinput文件夹

    [atguigu@hadoop101 hadoop-2.7.2]$ mkdir wcinput

    2. wcinput文件下创建一个wc.input文件

    [atguigu@hadoop101 hadoop-2.7.2]$ cd wcinput

    [atguigu@hadoop101 wcinput]$ touch wc.input

    3. 编辑wc.input文件

    [atguigu@hadoop101 wcinput]$ vi wc.input

     

    保存退出::wq

    4. 回到Hadoop目录/opt/module/hadoop-2.7.2

    5. 执行程序

    [atguigu@hadoop101 hadoop-2.7.2]$ hadoop jar

     share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount wcinput wcoutput

    6. 查看结果

    [atguigu@hadoop101 hadoop-2.7.2]$ cat wcoutput/part-r-00000

  • 相关阅读:
    模拟google分页效果
    真理胜于一切 JAVA模拟表单提交
    springboot @vaule注解失效解决办法
    安装cnpm
    公众号微信支付开发
    vue去掉链接中的#
    springboot集成mongoDB简易使用
    Spring boot中使用aop详解
    Promise 的基础用法
    MySQL的if,case语句使用总结
  • 原文地址:https://www.cnblogs.com/nidegui/p/11214055.html
Copyright © 2011-2022 走看看