【问题标题】:Apache Ignite Scala Program brings up Ignite Shell and does not progressApache Ignite Scala 程序启动 Ignite Shell 并且没有进展
【发布时间】:2016-09-27 23:40:21
【问题描述】:

这个非常简单的 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")

  }

}

【问题讨论】:

    标签: scala apache-spark ignite


    【解决方案1】:

    我认为,在调用 IgniteContest 之前不要启动 Ignite.sh。

    你需要做的:

    cd $IGNITE_HOME
    bin/ignite.sh
    

    【讨论】:

      猜你喜欢
      • 2022-06-17
      • 1970-01-01
      • 2022-12-15
      • 1970-01-01
      • 2017-07-30
      • 1970-01-01
      • 2022-12-04
      • 2018-03-02
      • 2021-07-23
      相关资源
      最近更新 更多