hive on spark

https://www.shiyanlou.com/courses/809/labs/2850/document

启动mysql服务
sudo service mysql start

启动hive(jps出现RunJar)并查看数据库和表
hive/bin/hive --service metastore &
hive/bin/hive
show databases;
show tables;
exit;

查看hive_meta中的所有表
mysql -uroot -p123456
use hive_meta;
show tables;
exit

hive/bin/hive
create table student(name string, age int, score double) row format delimited fields terminated by ',' stored as textfile;
load data inpath 'hdfs://localhost:9000/testdata/student.txt' into table student;
select * from student;
exit;

spark-2.1.0-bin-hadoop2.6/bin/spark-shell --master spark://db74499714f9:7077 --executor-memory 600m --driver-memory 600m
输出所有学生信息
spark.sql("select * from student").show();
输出年龄为22岁的学生姓名
spark.sql("select name from student where age=22").show();
输出学生的个数
spark.sql("select count(*) from student").show();