这个非常简单的Apache Ignite Scala程序将启动Ignite Shell,并且不会超出IgniteContext行;它只是等待,这是典型的REPL shell;我需要做什么更改才能不启动Ignite Shell?我所要做的就是将数据存储到ignite缓存中,然后从scala/spark程序中从ignite缓存中读取数据……
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.ignite.spark._
import org.apache.ignite.configuration._
object IgniteIt {
def main(args: Array[String]) {
println("\n==========\nIgnite!\n==========\n")
val cf = new SparkConf().setAppName("Ignite")
val sc = new SparkContext(cf)
val igniteContext = new IgniteContext(sc, "cfg/example-cache.xml")
val cacheRdd: org.apache.ignite.spark.IgniteRDD[Int,String] = igniteContext.fromCache("partitioned")
val data = Array((1,"One"),(2,"two"),(3,"three"),(4,"four"),(5,"five"))
val distData = sc.parallelize(data)
cacheRdd.savePairs(distData)
val result = cacheRdd.filter(_._2.contains("three")).collect()
result.foreach(println)
igniteContext.close(false)
println("\n==========\nDone!\n==========\n")
}
}发布于 2016-10-03 20:46:17
我认为,在调用IgniteContest之前不要启动Ignite.sh。
您需要做的是:
cd $IGNITE_HOME
bin/ignite.shhttps://stackoverflow.com/questions/39735915
复制相似问题