如何在 HDInsight 群集上的 SPARK 中使用图形框架

how to use graphframes inside SPARK on HDInsight cluster

我已经在 HDInsight 上设置了一个 SPARK 集群,并且正在尝试使用 GraphFrames using this tutorial

我已经在集群创建期间使用了自定义脚本来启用 spark 集群上的 GraphX,如此处所述。

当我运行记事本,

import org.apache.spark.sql._
import org.apache.spark.sql.functions._

import org.graphframes._

我收到以下错误

<console>:45: error: object graphframes is not a member of package org
       import org.graphframes._
                  ^

我尝试使用以下命令通过 Jupyter 从 spark 终端安装 graphframes

$SPARK_HOME/bin/spark-shell --packages graphframes:graphframes:0.1.0-spark1.5

但我仍然无法让它工作。我是 Spark 和 HDInsight 的新手,所以有人可以指出我还需要在此集群上安装什么才能使其正常工作。

今天,这在 spark-shell 中有效,但在 jupyter notebook 中无效。所以当你 运行 这个: $SPARK_HOME/bin/spark-shell --packages graphframes:graphframes:0.1.0-spark1.5 它在这个 spark-shell 会话的上下文中工作(至少在 spark 1.6 集群版本上)。 但是在jupyter中目前还没有加载包的方法。此功能将很快添加到集群中的 jupyter 笔记本中。同时可以使用spark-shell,或者spark-submit等

从 Maven 存储库上传或导入 graphframes 库后,您需要重新启动集群以附加库。

所以它适合我。