![](/img/trans.png)
[英]Exception raised with simple esRDD (elasticsearch-hadoop connector used in Spark)
[英]How to reindex data from one Elasticsearch cluster to another with elasticsearch-hadoop in Spark
我有兩個單獨的Elasticsearch集群,我想將第一個集群中的數據重新索引到第二個集群,但是我發現我只能在SparkContext配置中設置一個Elasticsearch集群,例如:
var sparkConf : SparkConf = new SparkConf()
.setAppName("EsReIndex")
sparkConf.set("es.nodes", "node1.cluster1:9200")
那么,如何在同一應用程序內部的Spark中使用彈性搜索-hadoop在兩個Elasticsearch集群之間移動數據?
您無需為此配置SparkConf內部的節點地址。
當您使用DataFrameWriter與elasticsearch
格式,你可以遵循通過該節點的地址作為一個選項:
val df = sqlContext.read
.format("elasticsearch")
.option("es.nodes", "node1.cluster1:9200")
.load("your_index/your_type")
df.write
.option("es.nodes", "node2.cluster2:9200")
.save("your_new_index/your_new_type")
這應該與spark 1.6.X和相應的elasticsearch-hadoop連接器一起使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.