shell脚本如图所示:
principal:代表的是认证方式
#!/bin/sh
#--------------------------------------------
#Date:
#Author:
#------------------------------------------------
################################################
. /etc/profile
. ~/.bash_profile
################################################
sql14_pc="
insert into table uv_daybyday_bylimin
select 20170814,count(t.uv),'pctotal' from (select uv from UV_TOTAL_DAY_BYLIMIN where dt between 20170813 and 20170814 group by uv) t;
"
sql15_pc="
insert into table uv_daybyday_bylimin
select 20170815,count(t.uv),'pctotal' from (select uv from UV_TOTAL_DAY_BYLIMIN where dt between 20170813 and 20170815 group by uv) t;
"
#调用hive, 执行上面的sql
/usr/lib/hive/bin/beeline -u "jdbc:hive2://10.10.10.10:10000/bd_warehouse;principal=bd-warehouse" --hiveconf mapreduce.job.queuename=datacenter -e "${sql14_pc}" -e "${sql15_pc}"