在xshell中执行hive sql 并将结果写入另一个txt文本中

在xshell 中进入文件夹:

vi test.sql

然后将要执行的sql输入,注意开头不能有空格

写完后按Esc键,输入:x保存并退出

输入下面代码:

/usr/bin/beeline -u "jdbc:hive2://dsrv1.heracles.sohuno.com:10000/mbadp;principal=hive/[email protected]" --hiveconf mapreduce.job.queuename=sohumb -f test.sql  > test.txt

将结果保存:

sz test.txt

猜你喜欢

转载自blog.csdn.net/weixin_38987362/article/details/80702776