作者:安安ahui | 来源:互联网 | 2023-09-11 13:43
我正在使用下面的Java代码读取es URL
public static void main(String[] args) {
SparkConf sparkCOnf= new SparkConf(true);
sparkConf.setappName(SparkMeasures.class.getName());
sparkConf.setMaster("local[*]");
sparkConf.set("spark.cleaner.ttl","3600");
sparkConf.set("es.nodes","SMD-GUG-TC1");
sparkConf.set("es.port","9204");
//sparkConf.set("es.resource.read","test/doc");
sparkConf.set("es.nodes.discovery","false");
sparkConf.set("es.nodes.wan.only","true");
sparkConf.set("es.field.read.empty.as.null","true");
sparkConf.set("es.nodes.client.only","true");
sparkConf.set("es.index.auto.create","true");
// http://SMD-GUG-TC1:9204/patient/
SparkSession spark = null;
try {
spark = SparkSession.builder().config(sparkConf).getOrCreate();
//spark = SparkSession.builder().set.config(sparkConf).getOrCreate();
//// JavaSparkContext jsc = new JavaSparkContext(sparkConf);
SparkContext sc = spark.sparkContext();
JavaSparkContext jsc = JavaSparkContext.fromSparkContext(sc);
JavaPairRDD> esRDD
= JavaEsspark.esRDD(jsc,"patient/doc");
esRDD.count();
} catch (Exception e) {
e.printStackTrace();
}
但出现错误,
org.elasticsearch.hadoop.EsHadoopIllegalArgumentException:找不到ID为[pqGdMxvTR8uHQnjCx5lwbw]的节点(是否启用了HTTP?)