• hive常用命令


    在安装完hive之后(hadoop-2.10.0安装hive-2.3.6),已经迫不及待的想尝试一下hive的一些用法,我们最常用的就是直接输入hive回车,使用的是cli(Command Line Interface )模式,下面介绍一下hive的使用以及一些常用的命令

    1.首先查看hive帮助,看一下hive提供了哪些命令

    hive --help 或者  hive --service help

    会出现hive命令的帮助信息:

     1 Usage ./hive <parameters> --service serviceName <service parameters>
     2 Service List: beeline cleardanglingscratchdir cli hbaseimport hbaseschematool help hiveburninclient hiveserver2 hplsql jar lineage llapdump llap llapstatus metastore metatool orcfiledump rcfilecat schemaTool version 
     3 Parameters parsed:
     4   --auxpath : Auxiliary jars 该选项允许用户指定一个以冒号分割的jar包。
     5   --config : Hive configuration directory 指定配置文件目录,覆盖系统默认的配置(${HIVE_HOME}/conf)
     6   --service : Starts specific service/component. cli is default 启动服务,cli是默认的服务。
     7 Parameters used:
     8   HADOOP_HOME or HADOOP_PREFIX : Hadoop install directory
     9   HIVE_OPT : Hive options
    10 For help on a particular service:
    11   ./hive --service serviceName --help
    12 Debug help:  ./hive --debug --help

    在执行hive命令是--service serviceName 指定服务类型,第二行service List即是支持的所有服务名称,下面介绍一下常用的服务:

    1)beeline:支持嵌入模式(embedded mode)和远程模式(remote mode)。在嵌入式模式下,运行嵌入式的Hive(类似Hive CLI),而远程模式可以通过Thrift连接到独立的HiveServer2进程上,要与HiveServer2配合使用,服务端启动hiveserver2客户的通过beeline两种方式连接到hive:

    1. beeline -u jdbc:hive2://localhost:10000/default -n root

    先通过beeline回车进入beeline命令行,在执行下面语句:
    2. beeline> !connect jdbc:hive2://<host>:<port>/<db> root 123

    2)cli:该命令就是(Command Line Interface )缩写,即命令行模式,通常直接使用hive回车进入,操作hive经常会用到

     3)hiveserver2:是hiveserver(不支持并发)的升级版,启动了一个server服务,默认监听端口:10000,客户端可以使用JDBC协议,支持多客户端的并发和认证,为开放API客户端如JDBC、ODBC提供了更好的支持。可以通过beeline连接在命令行操作,上面1中beeline连接就是连接到该服务,也可以通过java JDBC连接,启动hiveserver2命令:

    hive --service hiveserver2 &

    启动后使用java jdbc连接并操作数据:

  • 相关阅读:
    读书笔记之理想设计的特征
    一些javascript 变量声明的 疑惑
    LINQ 使用方法
    Google MySQL tool releases
    读书笔记之设计的层次
    EF之数据库连接问题The specified named connection is either not found in the configuration, not intended to be used with the Ent
    转载 什么是闭包
    javascript面向对象起步
    Tips
    数据结构在游戏中的应用
  • 原文地址:https://www.cnblogs.com/qixing/p/12289250.html
Copyright © 2020-2023  润新知