Hive执行命令方式有cli,jdbc,hwi,beeline,而我们常用的往往是cli shell 操作。
cli shell
hive -help
hive --help
注:命令脚本必须在集群的节点或hiveclient执行。
hive -e "select * from testtable"
hive -S -e "select * from testtable"
hive -S -e "select * from testtable" > /liguodong/hivedata/testtab
hive -v -e "select * from testtable" > /liguodong/hivedata/testtab
hive -f "/liguodong/hivedata/hql"
hive -v -e "select name from testtable" > /liguodong/hivedata/testtab
shell中使用hive
list和source命令
hive操作变量
配置变量
set val='';
${hiveconf:val}
环境变量
${env:HOME}
**注:**env查看所有环境变量