注意:需要提前搭建好hive,并對hive進行配置。并將spark配置成為spark on yarn模式。
1、將hive的配置文件添加到spark的目錄下
cp $HIVE_HOME/conf/hive-site.xml $SPARK_HOME/conf
2、開啟hive的hivemetastore服務(wù)
提前創(chuàng)建好啟動日志存放路徑
mkdir $HIVE_HOME/logStart
nohup /usr/local/lib/apache-hive-3.1.3-bin/bin/hive --service metastore > logStart/hivemetastore.log 2>&1 &
3、開啟spark的thriftserver服務(wù),運行端口為1000
cd $SPARK_HOME/sbin
start-thriftserver.sh
注意:其實還是hive的thirftserver服務(wù),同時還需要啟動spark集群
4、遠程連接thirftserver服務(wù)
連接thirftserver服務(wù)后,就可以使用hive的元數(shù)據(jù)(hive在hdfs中的數(shù)據(jù)庫和表),并且將spark作為分析引擎,來執(zhí)行hivesql了。
那我自己集群的數(shù)據(jù)做例子:文章來源:http://www.zghlxwxcb.cn/news/detail-727685.html
show databases ;
use clickhouse;
文章來源地址http://www.zghlxwxcb.cn/news/detail-727685.html
到了這里,關(guān)于spark on hive的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!