【发布时间】:2015-06-26 04:50:51
【问题描述】:
我需要建立从 Spark Streaming 到 Neo4j 图数据库的连接。RDD 的类型为((is,I),(am,Hello)(sam,happy)....)。我需要在 Neo4j 中的每对单词之间建立一个边缘。
在我发现的 Spark Streaming 文档中
dstream.foreachRDD { rdd =>
rdd.foreachPartition { partitionOfRecords =>
// ConnectionPool is a static, lazily initialized pool of connections
val connection = ConnectionPool.getConnection()
partitionOfRecords.foreach(record => connection.send(record))
ConnectionPool.returnConnection(connection) // return to the pool for future reuse
}
}
to the push to the data to an external database.
我在 Scala 中执行此操作。我有点迷茫怎么办?我找到了 AnormCypher 和 Neo4jScala 包装器。我可以用这些来完成工作吗?如果是这样,我该怎么做?如果没有,还有更好的选择吗?
谢谢大家......
【问题讨论】:
标签: scala neo4j apache-spark spark-streaming anormcypher