sparklyr
R package是否能够连接到YARN管理的hadoop集群?这似乎没有记录在cluster deployment文档中。使用Spark随附的SparkR
包,可以通过执行以下操作:
# set R environment variables
Sys.setenv(YARN_CONF_DIR=...)
Sys.setenv(SPARK_CONF_DIR=...)
Sys.setenv(LD_LIBRARY_PATH=...)
Sys.setenv(SPARKR_SUBMIT_ARGS=...)
spark_lib_dir <- ... # install specific
library(SparkR, lib.loc = c(sparkr_lib_dir, .libPaths()))
sc <- sparkR.init(master = "yarn-client")
但是当我交换上面的最后几行时
library(sparklyr)
sc <- spark_connect(master = "yarn-client")
我收到错误消息:
Error in start_shell(scon, list(), jars, packages) :
Failed to launch Spark shell. Ports file does not exist.
Path: /usr/hdp/2.4.2.0-258/spark/bin/spark-submit
Parameters: '--packages' 'com.databricks:spark-csv_2.11:1.3.0,com.amazonaws:aws-java-sdk-pom:1.10.34' '--jars' '<path to R lib>/3.2/sparklyr/java/rspark_utils.jar' sparkr-shell /tmp/RtmpT31OQT/filecfb07d7f8bfd.out
Ivy Default Cache set to: /home/mpollock/.ivy2/cache
The jars for the packages stored in: /home/mpollock/.ivy2/jars
:: loading settings :: url = jar:file:<path to spark install>/lib/spark-assembly-1.6.1.2.4.2.0-258-hadoop2.7.1.2.4.2.0-258.jar!/org/apache/ivy/core/settings/ivysettings.xml
com.databricks#spark-csv_2.11 added as a dependency
com.amazonaws#aws-java-sdk-pom added as a dependency
:: resolving dependencies :: org.apache.spark#spark-submit-parent;1.0
confs: [default]
:: resolution report :: resolve 480ms :: artifacts dl 0ms
:: modules in use:
-----------------------------------------
是
sparklyr
替代SparkR
还是在SparkR
软件包的顶部构建? 最佳答案
是的,sparklyr可用于纱线管理的簇。为了连接到纱线管理的集群,需要:
将SPARK_HOME环境变量设置为指向正确的spark主目录。
使用适当的主位置连接到Spark集群,例如:sc <- spark_connect(master = "yarn-client")
另请参阅:http://spark.rstudio.com/deployment.html