spark写数据到装有searchgard的ES集群

增加配置信息
 
  
val conf = new SparkConf()
conf.setAppName("etl_data_to_es")
conf.set("es.net.ssl", "true")
conf.set("es.net.ssl.truststore.location", "truststore.jks")
conf.set("es.net.ssl.protocol", "TLSv1.2")
conf.set("es.net.ssl.truststore.pass", "changeit")
conf.set("es.net.http.auth.user", "admin")
conf.set("es.net.http.auth.pass", "admin")
conf.set("es.batch.size.entries", "4000")
conf.set("es.batch.size.bytes", "4mb")
conf.set("es.nodes.wan.only", "false")
conf.set("es.internal.es.version","5.4.1")

添加资源

将truststore.jks文件放在项目的classpath目录下(resource文件夹中就行)

你可能感兴趣的:(elasticsearch)