Sys.setenv(HADOOP_CONF_DIR=‘/etc/hadoop/conf.cloudera.hdfs‘)
Sys.setenv(YARN_CONF_DIR=‘/etc/hadoop/conf.cloudera.yarn‘)
library(SparkR, lib.loc = "/opt/modules/spark/R/lib")
library(RHive)
sc <- sparkR.init(sparkHome = "/opt/modules/spark",
sparkPackages="com.databricks:spark-csv_2.10:1.4.0")
sqlContext <- sparkRSQL.init(sc)
rhive.connect("master", defaultFS=‘hdfs://master:8020‘,hiveServer2=TRUE,user="hue")
rhive.query("select * from data.data_orders limit 5")
rhive.close()
时间: 2024-10-14 20:12:28