我在尝试使用sparklyr::spark_write_csv()编写2个数据集时遇到了一个问题。这是我的配置:
# Configure cluster
config <- spark_config()
config$spark.yarn.keytab <- "mykeytab.keytab"
config$spark.yarn.principal <- "myyarnprincipal"
config$sparklyr.gateway.start.timeout <- 10
config$spark.executor.instances <- 2
config$spark.executor.cores <- 4
config$spark.executor.memory <- "4G"
config$spark.driver.memory <- "4G"
config$spark.kryoserializer.buffer.max <- "1G"
Sys.setenv(SPARK_HOME = "/opt/cloudera/parcels/CDH/lib/spark")
Sys.setenv(HADOOP_CONF_DIR = '/etc/hadoop/conf.cloudera.hdfs')
Sys.setenv(YARN_CONF_DIR = '/etc/hadoop/conf.cloudera.yarn')
# Configure cluster
sc <- spark_connect(master = "yarn-client", config = config, version = '1.6.0')
成功创建spark上下文后,我尝试使用spark_write_csv()在hdfs上保存两个数据集。作为中间步骤,我需要将数据帧转换为tbl_spark。不幸的是,我只能正确地保存第一个文件,而第二个文件(更大,但对于hadoop标准来说绝对不大,即360MB)花了很长时间,最后崩溃了。
# load datasets
tmp_small <- read.csv("first_one.csv", sep = "|") # 13 MB
tmp_big <- read.csv("second_one.csv", sep = "|") # 352 MB
tmp_small_Spark <- sdf_copy_to(sc, tmp_small, "tmp_small", memory = F, overwrite = T)
tables_preview <- dbGetQuery(sc, "SHOW TABLES")
tmp_big_Spark <- sdf_copy_to(sc, tmp_big, "tmp_big", memory = F, overwrite = T) # fail!!
tables_preview <- dbGetQuery(sc, "SHOW TABLES")
这可能是一个配置问题,但我不能弄清楚。这是错误:|================================================================================| 100% 352 MB
Error in invoke_method.spark_shell_connection(sc, TRUE, class, method, :
No status is returned. Spark R backend might have failed.
谢谢
发布于 2017-07-04 21:49:11
我在加载更大的文件时也遇到了问题。尝试将以下内容添加到spark连接配置文件中:
config$spark.rpc.message.maxSize <- 512
不过,这是一种变通方法。
https://stackoverflow.com/questions/44278085
复制相似问题