一、配置
//step 1: 获取job对象
Configuration configuration = new Configuration();
configuration.set("yarn.resourcemanager.address","192.168.174.120:8032");
configuration.set("mapreduce.framework.name","yarn");
configuration.set("fs.defaultFS", "hdfs://hadoop000:9000");
configuration.set("dfs.replication", "1");
configuration.set("mapreduce.app-submission.cross-platform","true");
Job job = Job.getInstance(configuration);
job.setJar("target/ruozedata-hadoop-1.0.jar");
可能会出现没有权限写hdfs的/tmp路径,需要设置环境变量HADOOP_USER_NMAE=hadoop(hadoop是我的超级用户)
2019-09-05_160037.png
二、结果展示
2019-09-05_160446.png2019-09-05_160545.png
网友评论