gpt4 book ai didi

hadoop - 使用 es-hadoop 写入 elasticsearch 时出现问题

转载 作者:可可西里 更新时间:2023-11-01 15:29:38 28 4
gpt4 key购买 nike

当我尝试使用带有 es-hadoop 的 mapreduce 程序写入 Elasticsearch 时出现此异常。我正在尝试写入已存在于我的 Elasticsearch 集群中的index=employee 和 type=basic

我的堆栈跟踪:-

Exception in thread "main" org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: No resource ['es.resource'] (index/query/location) specified at org.elasticsearch.hadoop.util.Assert.hasText(Assert.java:30) at org.elasticsearch.hadoop.mr.EsOutputFormat.init(EsOutputFormat.java:257) at org.elasticsearch.hadoop.mr.EsOutputFormat.checkOutputSpecs(EsOutputFormat.java:233) at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:266) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:139) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1308) at com.mstack.mapreduce.DIGDriver.main(DIGDriver.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.hadoop.util.RunJar.run(RunJar.java:221) at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

驱动类:-

Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "es-hadoop");
job.setJarByClass(DIGDriver.class);
conf.set("es.nodes", "localhost:9200");
conf.set("es.port", "9200");
conf.set("es.resource", "employee/basic");
job.setNumReduceTasks(0);
job.setOutputFormatClass(EsOutputFormat.class);
job.setMapperClass(DIGMapper.class);
job.setMapOutputValueClass(MapWritable.class);
conf.setBoolean("mapreduce.map.speculative", false);
conf.setBoolean("mapreduce.reduce.speculative", false);
boolean status = job.waitForCompletion(true);
if (status) {
System.exit(0);
} else {
System.out.println("Job Failed : Some error!");
System.exit(1);
}

最佳答案

通过更改配置解决了我自己的问题:-

conf.set("es.nodes", "localhost");
conf.set("es.port", "9200");

关于hadoop - 使用 es-hadoop 写入 elasticsearch 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36591469/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com