JanusGraph如何与Spark配合使用,是否有最新示例经验?

时间:2019-01-08 12:52:19

标签: scala apache-spark janusgraph

有人有火花流写和阅读JanusGraph的经验吗?我正在尝试遵循tinkerpop测试中的代码

        <dependency>
        <groupId>org.apache.tinkerpop</groupId>
        <artifactId>spark-gremlin</artifactId>
        <version>3.3.4</version>
        </dependency>

 def getSparkJanusConfig: BaseConfiguration = {
    val conf = new BaseConfiguration()
    conf.setProperty(Graph.GRAPH, "org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph")
    conf.setProperty("gremlin.hadoop.graphInputFormat", "org.janusgraph.hadoop.formats.cassandra.CassandraInputFormat")
    //    ####################################
    //    # Cassandra Cluster Config         #
    //    ####################################
    conf.setProperty("janusgraphmr.ioformat.conf.storage.backend", "cassandrathrift")
    conf.setProperty("storage.backend", "cassandra")
    conf.setProperty("storage.hostname", "127.0.0.1")
    conf.setProperty("cassandra.input.partitioner.class", "org.apache.cassandra.dht.Murmur3Partitioner")
    //    ####################################
    //    # Spark Configuration              #
    //    ####################################
    conf.setProperty("spark.master", "local[4]")
    conf.setProperty(Constants.GREMLIN_SPARK_PERSIST_CONTEXT, "true")
    conf.setProperty(Constants.SPARK_SERIALIZER, "org.apache.tinkerpop.gremlin.spark.structure.io.gryo.GryoSerializer")

    conf
  }

  /* SAVING TO JANUS */
  val gremlinSpark = Spark.create(spark.sparkContext)
  val graph = GraphFactory.open(getSparkJanusConfig)

0 个答案:

没有答案