希望在spark-shell中测试集群方式的elasticsearch操作,
# 1 首先下载相关的jar
# 2 启动spark-shell时用--jars
./bin/spark-shell –master spark://master:7077 –jars /usr/local/spark-1.6.2/lib/elasticsearch-spark_2.10-2.2.0.jar
# 3 需要用conf设置es.nodes
val conf = new SparkConf()
conf.set("es.index.auto.create", "true")
conf.set("es.nodes", "192.168.1.102,192.168.1.103,192.168.1.104")
时间: 2024-10-10 05:23:38