나는 sparkR 코드를 작성했으며 EMR 클러스터에서 spark-submit 또는 sparkR을 사용하여 제출할 수 있는지 궁금합니다.EMR 클러스터에서 spark-submit 또는 sparkR을 사용하여 SparkR 스크립트를 실행하는 방법은 무엇입니까?
내가 예를 들어 여러 가지 방법을 시도 :
Error in sparkR.sparkContext(master, appName, sparkHome, sparkConfigMap, :
JVM is not ready after 10 seconds
샘플 코드 :
또는 sparkR --no-저장 mySparkScript.r 등하지만 오류가 아래에 무엇입니까마다 sparkR mySparkRScript.r을#Set the path for the R libraries you would like to use.
#You may need to modify this if you have custom R libraries.
.libPaths(c(.libPaths(), '/usr/lib/spark/R/lib'))
#Set the SPARK_HOME environment variable to the location on EMR
Sys.setenv(SPARK_HOME = '/usr/lib/spark')
#Load the SparkR library into R
library(SparkR, lib.loc = c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib")))
#Initiate a Spark context and identify where the master node is located.
#local is used here because the RStudio server
#was installed on the master node
sc <- sparkR.session(master = "local[*]", sparkEnvir = list(spark.driver.memory="2g"))
sqlContext <- sparkRSQL.init(sc)
참고 : 내 코드를 직접 붙여 넣거나 source("mySparkRScript.R")을 사용하여 sparkr-shell에서 실행할 수 있습니다.
참조 :
- Crunching Statistics at Scale with SparkR on Amazon EMR
- SparkR Spark documentation
- R on Spark
- Executing-existing-r-scripts-from-spark-rutger-de-graaf
- Github