文章来源:【about云论坛社区】http://www.aboutyun.com/thread-8652-1-1.html
内容比较详细
部分java代码:
- Configuration conf=new Configuration();
-
- //conf.set("mapreduce.job.jar", "myjob.jar");
- conf.set("fs.defaultFS","hdfs://192.168.46.28:9000");//设置dfs单点访问
- conf.set("mapreduce.framework.name", "yarn"); //设置mapreduce运行框架yarn
- conf.set("yarn.resourcemanager.address", "192.168.46.28:8032"); //设置resourcemanager位置
- /**Job任务**/
- //Job job=new Job(conf, "testwordcount");//废弃此API
- Job job=Job.getInstance(conf, "new api");
- job.setJarByClass(MyWordCount.class);
- System.out.println("模式: "+conf.get("mapreduce.jobtracker.address"));;
=============================================================================
hadoop2.4.1【windows环境,测试不可以,需要打成jar包,提交到linux服务器上】
hdfs zk访问
config.set("ha.zookeeper.quorum", "192.168.1.15:2181,192.168.1.14:2181,192.168.1.13:2181");