Hive命令 参数

1、hive -h
    显示帮助

2、hive -h hiveserverhost -p port
    连接远程hive服务器

3、hive --define a=1 --hivevar b=1 --hiveconf hive.cli.print.current.db=true
    见《Hive设置变量

4、hive -e "show tables";
    直接执行hivesql语句

    hive -e "show tables;" > a.txt;
    将执行结果(覆盖)输出到a.txt文件里,>>是追加

5、hive -f a.hql
    执行hsql文件,可以是hdfs上的文件
    hive -f /path/to/dir/a.hql;
    hive -f hdfs://vm1:8020/path/to/dir/a.hql;

6、hive -S -e "show tables;";
    -S 静默执行

7、hive -i init.sql
    hive会话刚启动后,立即执行hql里的内容

  1. [hive@vm1 conf]$ hive -h
  2. Missing argument for option: h
  3. usage: hive
  4. -d,--define <key=value> Variable subsitution to apply to hive
  5. commands. e.g. -d A=B or --define A=B
  6. --database <databasename> Specify the database to use
  7. -e <quoted-query-string> SQL from command line
  8. -f <filename> SQL from files
  9. -H,--help Print help information
  10. -h <hostname> connecting to Hive Server on remote host
  11. --hiveconf <property=value> Use value for given property
  12. --hivevar <key=value> Variable subsitution to apply to hive
  13. commands. e.g. --hivevar A=B
  14. -i <filename> Initialization SQL file
  15. -p <port> connecting to Hive Server on port number
  16. -S,--silent Silent mode in interactive shell
  17. -v,--verbose Verbose mode (echo executed SQL to the
  18. console)





posted @ 2015-06-08 14:05  lishouguang  阅读(922)  评论(0编辑  收藏  举报