搭建map-reduce开发环境

## Launch IntelliJ

## create Java project - for example "wordcount"
select ‘Create New Project’
    -> "Java project"
    -> select 1.8 JDK in "Project SDK"
    -> Next -> Next
    -> enter "wordcount" in "Project name"
    -> enter "~/work/wordcount" in "Project location"
    -> Finish

## create Java Class
select File -> New -> "Java Class" -> enter "WordCount" -> Create
then a new file generated under src/

## add the Hadoop module dependencies
select File -> "Project Structure" -> Modules -> Dependencies
    -> "+" -> "JARS or directories"
Browse to the Hadoop installation, select jar files under following directorys:
    share/hadoop/common
    share/hadoop/common/lib
    share/hadoop/mapreduce
    share/hadoop/yarn

## configure
select Run -> "Edit Configuration" -> Application -> "+"
    -> enter "WordCount" in "Main class"
    -> enter "input output" as input / output path in "Program arguments"
    -> Apply -> OK
put the input text under "~/work/mapreduce/input"

## coding and run / debug
Note:
    in IntelliJ, WordCount runs with Hadoop standalone mode
    don't forget to delete "~/work/mapreduce/output" before running

## create a jar file
$ cd out/production/mapreduce
$ jar cvf ../../../wordcount.jar *.class

## run with Hadoop pseudo-distributed mode
$ hdfs dfs -rm -f -r output
$ hadoop jar wordcount.jar WordCount input output
$ hdfs dfs -cat output/*

reference: https://tokluo.wordpress.com/2016/01/31/using-intellij-to-write-your-application/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值