Hive 教程(六)-Hive Cli
hive 有两种启动方式,一种是 bin/hive,一种是 hiveserver2,
bin/hive 是 hive 的 shell 模式,所有任务在 shell 中完成,shell 就相当于 hive cli
hive 命令行参数
[root@hadoop10 hive2.3.6]# hive --heip
-d,--define <key=value> Variable substitution to apply to Hive
commands. e.g. -d A=B or --define A=B
--database <databasename> Specify the database to use
-e <quoted-query-string> SQL from command line
-f <filename> SQL from files
-H,--help Print help information
--hiveconf <property=value> Use value for given property
--hivevar <key=value> Variable substitution to apply to Hive
commands. e.g. --hivevar A=B
-i <filename> Initialization SQL file
-S,--silent Silent mode in interactive shell
-v,--verbose Verbose mode (echo executed SQL to the
console)
Hive Batch Mode Commands
-e:不进入 shell,在 linux 命令行执行 sql
[root@hadoop10 hive2.3.6]# hive -e 'select * from hive1.hive_01 limit 10';
注意指定 数据库和数据表
-f:在文件中执行 sql
把 sql 语句写入文件,随便什么文件格式
[root@hadoop10 hive2.3.6]# hive -f sql.sh
Hive Interactive Shell Commands
交互命令
|
Command |
Description |
|---|---|
|
quit |
Use quit or exit to leave the interactive shell. |
|
reset |
Resets the configuration to the default values (as of Hive 0.10: see HIVE-3202). |
|
set <key>=<value> |
Sets the value of a particular configuration variable (key). |
|
set |
Prints a list of configuration variables that are overridden by the user or Hive. |
|
set -v |
Prints all Hadoop and Hive configuration variables. |
|
add FILE[S] <filepath> <filepath>* |
Adds one or more files, jars, or archives to the list of resources in the distributed cache. See Hive Resources below for more information. |
| add FILE[S] <ivyurl> <ivyurl>* add JAR[S] <ivyurl> <ivyurl>* add ARCHIVE[S] <ivyurl> <ivyurl>* |
As of Hive 1.2.0, adds one or more files, jars or archives to the list of resources in the distributed cache using an Ivy URL of the form ivy://group:module:version?query_string. See Hive Resourcesbelow for more information. |
|
list FILE[S] |
Lists the resources already added to the distributed cache. See Hive Resources below for more information. |
|
list FILE[S] <filepath>* |
Checks whether the given resources are already added to the distributed cache or not. See Hive Resources below for more information. |
|
delete FILE[S] <filepath>* |
Removes the resource(s) from the distributed cache. |
| delete FILE[S] <ivyurl> <ivyurl>* delete JAR[S] <ivyurl> <ivyurl>* delete ARCHIVE[S] <ivyurl> <ivyurl>* |
As of Hive 1.2.0, removes the resource(s) which were added using the <ivyurl> from the distributed cache. See Hive Resources below for more information. |
|
! <command> |
Executes a shell command from the Hive shell. |
|
dfs <dfs command> |
Executes a dfs command from the Hive shell. |
|
<query string> |
Executes a Hive query and prints results to standard output. |
|
source <filepath> |
Executes a script file inside the CLI. |
hive cli 操作 hdfs
hive> dfs - ls /;
hive cli 操作本地文件
hive> ! ls /usr/lib/hive2.3.6;
bin
binary-package-licenses
conf
examples
Hive Resources
参考官网
参考资料:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Cli 官网
Hive 教程(六)-Hive Cli的更多相关文章
- HIVE教程
完整PDF下载:<HIVE简明教程> 前言 Hive是对于数据仓库进行管理和分析的工具.但是不要被“数据仓库”这个词所吓倒,数据仓库是很复杂的东西,但是如果你会SQL,就会发现Hive是那 ...
- Hive教程(1)
1. 介绍 Apache Hive可以使用SQL来读,写,管理分布式存储的大数据集,结构可以投射到已经存储的数据上,命令行工具和JDBC驱动可以让用户连接到Hive. 2. 安装和配置 你可以下载Hi ...
- hive (1)Cli命令
查看命令选项 # hive --help Usage ./hive <parameters> --service serviceName <service parameters> ...
- Hive 教程(二)-认知hive
在大数据领域,hive 的位置非常重要,排名前三的大数据工具为 spark.hive.kafka 什么是hive 在大数据领域有 3 种需求场景:传输.存储.计算: hive 是一个处理海量的结构化数 ...
- Hive 教程(三)-DDL基础
DDL,Hive Data Definition Language,数据定义语言: 通俗理解就是数据库与库表相关的操作,本文总结一下基本方法 hive 数据仓库配置 hive 数据仓库默认位置在 hd ...
- Hive 教程(一)-安装与配置解析
安装就安装 ,不扯其他的 hive 依赖 在 hive 安装前必须具备如下条件 1. 一个可连接的关系型数据库,如 Mysql,postgresql 等,用于存储元数据 2. hadoop,并启动 h ...
- Hive 12、Hive优化
要点:优化时,把hive sql当做map reduce程序来读,会有意想不到的惊喜. 理解hadoop的核心能力,是hive优化的根本. 长期观察hadoop处理数据的过程,有几个显著的特征: 1. ...
- 别只用hive写sql -- hive的更多技能
hive是Apache的一个顶级项目,由facebook团队开发,基于java开发出面向分析师或BI等人员的数据工具(常用作出具仓库),它将文件系统映射为表,使用SQL实现mapreduce任务完成分 ...
- shell命令执行hive脚本(hive交互,hive的shell编程)
Hive执行方式 Hive的hql命令执行方式有三种: 1.CLI 方式直接执行 2.作为字符串通过shell调用hive –e执行(-S开启静默,去掉"OK","Tim ...
随机推荐
- AtCoder AGC031D A Sequence of Permutations (群论、置换快速幂)
题目链接 https://atcoder.jp/contests/agc031/tasks/agc031_d 题解 这居然真的是个找规律神题... 首先要明白置换的一些基本定义,置换\(p\)和\(q ...
- C++入门经典-例8.2-构造函数的访问顺序
1:父类和子类中都有构造函数和析构函数,那么子类对象在创建时是父类先进行构造还是子类先进行构造?同样,在子类对象释放时,是父类先进行释放,还是子类先进行释放?这都是有先后顺序的.答案是当从父类派生一个 ...
- C++ STL 中 map 容器
C++ STL 中 map 容器 Map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据 处理能力,由于这个特性,它 ...
- sentinel.conf样例
#禁止用localhost与127.0.0.1# Example sentinel.conf # 哨兵sentinel实例运行的端口 默认26379port 26379 # 哨兵sentinel的工作 ...
- 生成ip地址表的不同姿势--脚本生成和echo命令生成
前段时间参加了几个线下的靶机攻防比赛,几十个队伍,如果攻击的时候一个个攻击就非常麻烦,浪费时间.所以需要批量攻击.批量攻击就需要一个完整的ip地址表.在这里总结一下... 有不足的地方欢迎评论 一.脚 ...
- mysql 安装 和 mysql 远程连接
一.mysql安装 1.下载MySQL数据库可以访问官方网站:https://www.mysql.com/ 2.点击DOWNLOADS模块下的Community模块下的MySQL Community ...
- 小D课堂 - 零基础入门SpringBoot2.X到实战_第14节 高级篇幅之SpringBoot多环境配置_59、SpringBoot多环境配置介绍和项目实战
笔记 1.SpringBoot多环境配置介绍和项目实战(核心知识) 简介:SpringBoot介绍多环境配置和使用场景 1.不同环境使用不同配置 例如数据库配置,在开发的时候, ...
- RxJava2实战---第五章 变换操作符和过滤操作符
RxJava2实战---第五章 变换操作符和过滤操作符 RxJava的变换操作符主要包括以下几种: map():对序列的每一项都用一个函数来变换Observable发射的数据序列. flatMap() ...
- Spark内核源码解析
1.spark内核架构常用术语 Application:基于spark程序,包含一个driver program(客户端程序)和多个executeor(线程) Driver Progrom:代表着sp ...
- Java ——注释 命名
注释 1.类在每个类前面必须加上类注释,注释模板如下:/*** Copyright (C), 2006-2010, ChengDu Lovo info. Co., Ltd.* FileName: Te ...