启动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
If you'd like to connect via NOSASL mode, you must specify the authentication mode explicitly:
% bin/beeline
beeline> !connect jdbc:hive2://<host>:<port>/<db>;auth=noSasl hiveuser pass org.apache.hive.jdbc.HiveDriver
Beeline Commands
Command
Description
!<SQLLine command> | List of SQLLine commands available at http://sqlline.sourceforge.net/. Example: |
Beeline Command Options
The Beeline CLI supports these command line options:
Option
Description
-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:
1 2 | >hive-h<hostname>-p <port> |
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:
1 2 | >beeline-u <url>-n<username>-p <password> |
Query Execution
Executing queries in Beeline is very similar to that in Hive CLI. In Hive CLI:
1 2 | >hive-e<query inquotes> >hive-f<query file name> |
In Beeline:
1 2 | >beeline-e<queryinquotes> >beeline-f<queryfilename> |
Another important command is !quit
(or !q
), which allows you to exit interactive mode:
1 2 | 0:jdbc:hive2://> !quit Closing:org.apache.hive.jdbc.HiveConnection |
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
0
顶
0
踩
分享到:
基于spark1.3.1的spark-sql实战-02 | 基于spark1.3.1的spark-sql实战-01
评论
发表评论
相关资源推荐
- HIVESERVER2 HA配置及使用(java)
- Hive Beeline HiveServer2使用
- HiveServer2 入门使用
- Hive HiveServer2使用
- hive的HiveServer2/beeline配置及使用
- HiveServer2的配置使用
- HiveServer2的HA
- 互联网产品经理从入门到精通--视频资料
- python操作hiveserver2相关工具集
- hiveserver2详解
- HiveServer2的常见问题
- HiveServer2的高可用-HA配置
- dip-data-analyze 使用的hiveserver 实践之 jvm调优
- 大数据Hive系列之HiveServer2用户安全认证
- HiveServer2 获取日志
- beeline通过HiveServer2访问Hive的配置和操作
- hiveserver 占用内存过大的问题
- Hiveserver2配置及优化
- HiveServer2的客户端
- hiveserver2遇到的问题
- Hive学习之HiveServer2服务端配置与启动,允许远程连接
- hive三种方式区别和搭建、HiveServer2环境搭建、HWI环境搭建和beeline环境搭建
- 【广告算法工程师入门 1】互联网广告的商业模式
- Hive的内置服务和hiveserver/hiveserver2的比较
- jdbc远程连接hiveserver2
- hiveserver2 后台运行
- Hive从2.0版本开始,关于hiveserver2的web UI管理页面的配置和使用
- Java代码通过JDBC连接Hiveserver2
- [Hive]HiveServer2概述
- Eclipse JDBC连接Hive 两种方法 hiveserver hiveserver2
- Hive学习之HiveServer2服务端配置与启动,允许远程连接
- hive三种方式区别和搭建、HiveServer2环境搭建、HWI环境搭建和beeline环境搭建
- 【广告算法工程师入门 1】互联网广告的商业模式
- Hive的内置服务和hiveserver/hiveserver2的比较
- jdbc远程连接hiveserver2
- hiveserver2 后台运行
- Hive从2.0版本开始,关于hiveserver2的web UI管理页面的配置和使用
- Java代码通过JDBC连接Hiveserver2
- [Hive]HiveServer2概述
- Eclipse JDBC连接Hive 两种方法 hiveserver hiveserver2
- hiveServer2 挂起处理
- hiveserver2无法正常启动 ,无法绑定10000端口
- HiveServer2表结构变更太耗时分析
- Hive学习之HiveServer2 JDBC客户端
- hiveserver2总是启动不起来
- HDP Hiveserver2搭建高可用
- hiveserver2&&beeline&&java client
- hiveserver2 权限管控
- HiveServer2 Clients
- Hive学习之HiveServer2服务端配置与启动
- Hive学习笔记1@Hiveserver2高可用实现
- Hiveserver2 的简单配置说明
- Hiveserver2的代理执行之路
- Mapr与Hive工作(二)——使用HiveServer2
- 计算机网络理论基础
- Hive的hiveserver2后台开启和关闭
- Hiveserver2的使用
- HiveServer2 源码分析
- 之二十-自定义HiveServer2的用户安全认证
- hiveserver2 是什么?
上滑加载更多