Beeline – 一个新的命令行Shell
HiveServer2 supports a new command shell Beeline that works with HiveServer2. It's a JDBC client that is based on the SQLLine CLI (http://sqlline.sourceforge.net/). There’s detailed documentation of SQLLine which is applicable to Beeline as well.
The Beeline shell works in both embedded mode as well as remote mode. In the embedded mode, it runs an embedded Hive (similar to Hive CLI) whereas remote mode is for connecting to a separate HiveServer2 process over Thrift. Starting inHive 0.14, when Beeline is used with HiveServer2, it also prints the log messages from HiveServer2 for queries it executes to STDERR.
Beeline 要与HiveServer2配合使用,支持嵌入模式和远程模式
启动HiverServer2 , ./bin/hiveserver2
启动Beeline
wangyue@wangyue-um:~/opt/hive/hive-0.12.0-cdh5.1.0$ ./bin/beeline
beeline> !connect jdbc:hive2://localhost:10000
默认 用户名就是登录账号 密码为空
Beeline with NoSASL connection
Beeline Commands
!<SQLLine command> |
List of SQLLine commands available at http://sqlline.sourceforge.net/. Example: |
Beeline Command Options
The Beeline CLI supports these command line options:
-u <database URL> |
The JDBC URL to connect to. Usage: |
-n <username> |
The username to connect as. Usage: |
-p <password> |
The password to connect as. Usage: |
-d <driver class> |
The driver class to use. Usage: |
-e <query> |
Query that should be executed. Double or single quotes enclose the query string. This option can be specified multiple times. Usage: Support to run multiple sql statements separated by semicolons in a single query_string: 1.2.0 (HIVE-9877) Bug fix (--headerInterval not honored): 0.14.0 (HIVE-7647) |
-f <file> |
Script file that should be executed. Usage: Version: 0.12.0 (HIVE-4268) Bug to be fixed (running |
--hiveconf property=value |
Use value for the given configuration property. Properties that are listed in hive.conf.restricted.list cannot be reset with hiveconf (see Restricted List and Whitelist). Usage: Version: 0.13.0 (HIVE-6173) |
--hivevar name=value |
Hive variable name and value. This is a Hive-specific setting in which variables can be set Usage: |
--color=[true/false] |
Control whether color is used for display. Default is false. Usage: (Not supported for Separated-Value Output formats. See HIVE-9770) |
--showHeader=[true/false] |
Show column names in query results (true) or not (false). Default is true. Usage: |
--headerInterval=ROWS |
The interval for redisplaying column headers, in number of rows, when outputformat is table. Usage: (Not supported for Separated-Value Output formats. See HIVE-9770) |
--fastConnect=[true/false] |
When connecting, skip building a list of all tables and columns for tab-completion of Usage: |
--autoCommit=[true/false] |
Enable/disable automatic transaction commit. Default is false. Usage: |
--verbose=[true/false] |
Show verbose error messages and debug information (true) or do not show (false). Usage: |
--showWarnings=[true/false] |
Display warnings that are reported on the connection after issuing any HiveQL commands. Usage: |
--showNestedErrs=[true/false] |
Display nested errors. Default is false. Usage: |
--numberFormat=[pattern] |
Format numbers using a DecimalFormat pattern. Usage: |
--force=[true/false] |
Continue running script even after errors (true) or do not continue (false). Default is false. Usage: |
--maxWidth=MAXWIDTH |
The maximum width to display before truncating data, in characters, when outputformat is table. Usage: |
--maxColumnWidth=MAXCOLWIDTH |
The maximum column width, in characters, when outputformat is table. Default is 15. Usage: |
--silent=[true/false] |
Reduce the amount of informational messages displayed (true) or not (false). It also stops displaying the log messages for the query from HiveServer2 (Hive 0.14 and later) and the HiveQL commands (Hive 1.2.0 and later). Default is false. Usage: |
--autosave=[true/false] |
Automatically save preferences (true) or do not autosave (false). Default is false. Usage: |
--outputformat=[table/vertical/csv/tsv/dsv/csv2/tsv2] |
Format mode for result display. Default is table. See Separated-Value Output Formats below for description of recommended sv options. Usage: Version: dsv/csv2/tsv2 added in 0.14.0 (HIVE-8615) |
--truncateTable=[true/false] |
If true, truncates table column in the console when it exceeds console length. Version: 0.14.0 (HIVE-6928) |
--delimiterForDSV= DELIMITER |
The delimiter for delimiter-separated values output format. Default is '|' character. Version: 0.14.0 (HIVE-7390) |
--isolation=LEVEL |
Set the transaction isolation level to TRANSACTION_READ_COMMITTED Usage: |
--nullemptystring=[true/false] |
Use historic behavior of printing null as empty string (true) or use current behavior of printing Usage: Version: 0.13.0 (HIVE-4485) |
--incremental=[true/false] |
Print output incrementally. |
--help |
Display a usage message. Usage: |
Server Connection
Hive CLI connects to a remote HiveServer1 instance using the Thrift protocol. To connect to a server, you specify the host name and optionally the port number of the remote server:
In contrast, Beeline connects to a remote HiveServer2 instance using JDBC. Thus, the connection parameter is a JDBC URL that’s common in JDBC-based clients:
Query Execution
Executing queries in Beeline is very similar to that in Hive CLI. In Hive CLI:
In Beeline:
Another important command is !quit
(or !q
), which allows you to exit interactive mode:
https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients
http://blog.cloudera.com/blog/2014/02/migrating-from-hive-cli-to-beeline-a-primer/
尊重原创,未经允许不得转载:http://blog.csdn.net/stark_summer/article/details/45844403
相关推荐
HiveServer2-JDBC及用户权限测试
docker-hiveserver2
本文将详细介绍如何在Hive中设置用户名和密码,从而保证连接的鉴权与安全。基本思路是先自定义一个权限认证类接收用户名和密码,打成jar包后放到到HIVE的Lib目录下...本文档基于HIVE 3.12 支持最新的Hive和 Hadoop版本。
HiveServer2日志摘要器用法 #download latest scriptwget https://raw.githubusercontent.com/abajwa-hw/hiveServer2logparser/master/hiveServer2logparser.pl#run scriptperl hiveServer2logparser.pl <path>输出...
HiveServer2 账号密码鉴权类编译 Jar 包
============Hive的beeline权限配置============ 1)HDFS修改core-site.xml配置 搜索 core-site.xml ...2)YARN (MR2 Included)修改core-site.xml配置 java.sql.SQLException: Could not open client transpor
php连接hive, 基于thrift2 & hiveserver2 Thrift/transport/TSaslClientTransport.php 这里的username password也得改.... 密码为空的话随便填一个 这个文件务必也要一起修改, 否则涉及mapreduce的计算都无法执行
cdh6.3.2升级hive至3.x后登陆HiveServer2连接失败
hive自带的启停hive服务非常不方便,操作麻烦,那么有没什么办法一键启停hive服务呢?这个文章就是解决这个问题的
hive1.2.1使用jdbc连接hive server2的所有jar包
既可以连接没有kerberos的hive也可以连接有kerberos的hive
Hive JDBC连接示例该项目展示了如何使用各种不同的方法连接到Hiveserver2。 所有类仅适用于Hiveserver2。 正在使用Cloudera JDBC驱动程序,可以从下载。 在撰写本文时,最新版本为v2.5.15 。要求: 您需要下载驱动...
hive自定义安全认证使用
pyhs2-0.6.0.tar.gz手动安装包,python连接hiveserver2的工具包,①python setup.py build ②python setup.py install
hive配置参数及含义, 在大数据维护中对hive的优化参数的配置明细
Bee通过C ++节俭库与HiveServer交互,从而使客户端依赖性最小化,并且处理速度很快。安装你会需要: 节俭> = 0.9.2(包括开发标头) R包:Rcpp和dplyr 制作然后运行: R CMD INSTALL .用法library(bee)bee <- ...
SpringBoot整合HiveJdbc, 远程连接HiveServer2,并结合Java和HiveSQL 对存储在Hadoop 的6万条电商数据,进行数据分析。后端生成Json 格式,前端解析Json格式,并实现数据大屏可视化。 通过大数据分析,生成有价值...
hs2client, C 和Hive的本机客户端,带有 python/Pandas 绑定 hs2client: Impala和Hive的C Thrift 客户端生成状态 这是一个新项目,用于在 C 中创建一个...高性能的开源HiveServer2客户端库。 in Impala和使用HiveServer
windows下安装hive2.3.x 需要cmd文件,解压覆盖bin目录即可。原本想免积分的,没有这个选项,愿资源槛低一点,学习更容易一点。
是一款通过 JDBC 连接 HiveServer2 的图形界面工具(JDBC 就是 Java 数据库连接,说白了就是用 Java 语言来操作数据库)。 简单介绍一下 DataGrip: 由 JetBrains 公司推出的数据库管理软件, 几乎支持所有主流 的...