【问题标题】:How may I connect Google Dataproc cluster from Sparklyr?如何从 Sparklyr 连接 Google Dataproc 集群?
【发布时间】:2017-02-07 00:34:18
【问题描述】:

我是 Spark 和 GCP 的新手。我尝试使用

连接到它
sc <- spark_connect(master = "IP address")

但它显然无法工作(例如,没有身份验证)。

我该怎么做?是否可以从 Google Cloud 外部连接到它?

【问题讨论】:

    标签: google-cloud-platform google-cloud-dataproc sparklyr


    【解决方案1】:

    从集群外部连接到 Spark on Dataproc 存在两个问题:配置和网络访问。它通常有点困难并且不完全支持,所以我建议在集群内使用 sparklyr。

    配置

    Google Cloud Dataproc 在 Hadoop YARN 上运行 Spark。你实际上需要使用yarn-cluster

    sc <- spark_connect(master = 'yarn-client')
    

    但是,您还需要在您的 $SPARK_HOME 目录中添加一个 yarn-site.xml 以将 Spark 指向正确的主机名。

    网络访问

    虽然您可以在 Google Compute Engine 网络上使用 firewall rules 为您的 IP 地址打开端口,但这并不是一种好的安全做法。您还需要将 YARN 配置为使用实例的外部 IP 地址或有办法解析您机器上的主机名。

    在 Dataproc 上使用 sparklyr

    sparklyr 可以通过 SSH 连接到主节点并运行 R REPL 来安装和运行:

    $ # Needed for the curl library
    $ sudo apt-get install -y libcurl4-openssl-dev
    $ R
    > install.packages('sparklyr')
    > library(sparklyr)
    > sc <- spark_connect(master = 'yarn-client')
    

    我相信RStudio Server支持SOCKS代理,可以设置as described here,但是我对RStudio不是很熟悉。

    我将Apache Zeppelin on Dataproc 用于 R 笔记本,但它会自动加载 SparkR,我认为目前它不能与 sparklyr 配合使用。

    【讨论】:

      猜你喜欢
      • 2017-10-19
      • 1970-01-01
      • 2017-07-02
      • 2018-11-11
      • 2021-03-10
      • 2017-09-10
      • 2018-10-21
      • 2020-01-31
      • 2016-07-14
      相关资源
      最近更新 更多