1

我用 5 个节点的 hadoop 集群创建了 IBM BigInsights 服务(包括带有 SparkR 的 Apache Spark)。我尝试使用 SparkR 连接 cloudant db 并获取一些数据并进行一些处理。

在 BigInsights Hadoop 集群中使用 spark-submit 提交 SparkR 作业(R 脚本)失败。我创建了 SparkR 脚本并运行了以下代码,

-bash-4.1$ spark-submit --master local[2] test_sparkr.R
16/08/07 17:43:40 WARN SparkConf: The configuration key 'spark.yarn.applicationMaster.waitTries' has been deprecated as of Spark 1.3 and and may be removed in the future. Please use the new key 'spark.yarn.am.waitTime' instead.
Error: could not find function "sparkR.init"
Execution halted
-bash-4.1$

test_sparkr.R 文件的内容是:

# Creating SparkConext and connecting to Cloudant DB
sc <- sparkR.init(sparkEnv = list("cloudant.host"="<<cloudant-host-name>>","<<><<cloudant-user-name>>>","cloudant.password"="<<cloudant-password>>", "jsonstore.rdd.schemaSampleSize"="-1"))

# Database to be connected to extract the data
database <- "testdata"
# Creating Spark SQL Context
sqlContext <- sparkRSQL.init(sc)
# Creating DataFrame for the "testdata" Cloudant DB
testDataDF <- read.df(sqlContext, database, header='true', source = "com.cloudant.spark",inferSchema='true')

如何在 IBM BigInsights 中安装 spark-cloudant 连接器并解决问题。请做需要的事。帮助将不胜感激。

4

1 回答 1

0

我相信 spark-cloudant 连接器还不适用于 R。

希望我可以更新这个答案!

于 2016-08-08T11:10:50.720 回答