spark-sql(spark sql cli)客戶端集成hive
1、安裝hadoop集群
參考:http://www.cnblogs.com/wcwen1990/p/6739151.html
2、安裝hive
參考:http://www.cnblogs.com/wcwen1990/p/6757240.html
3、安裝配置spark
編譯spark:http://www.cnblogs.com/wcwen1990/p/7688027.html
部署參考:http://www.cnblogs.com/wcwen1990/p/6889521.html
4、spark-sql集成hive
拷貝hdfs-site.xml、hive-site.xml配置文件到spark conf/目錄下:
$ cp /opt/cdh-5.3.6/hive-0.13.1-cdh5.3.6/conf/hive-site.xml .
$ cp /opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6/etc/hadoop/hdfs-site.xml .
5、啟動spark-sql
$ bin/spark-sql --master local[2]
啟動之後可以在shell客戶端進行交互式HQL訪問hive數據庫了。
6、測試:
spark-sql (default)> show databases;
... ...
result
chavin
default
... ...
spark-sql (default)> select * from chavin.dept;
... ...
deptno dname loc
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
Time taken: 0.378 seconds, Fetched 4 row(s)
... ...
spark-sql(spark sql cli)客戶端集成hive