Beeline 是什么?

它是一个命令行形式的jdbc客户端。搞Java开发的同学,看到这里就应该知道这货是什么了 ── 它是一个连接数据库的工具。

只不过Beeline连接的数据库是HiveServer2。

Beeline 有两种工作模式:内嵌、远程。

内嵌模式中,会运行一个内嵌的Hive(类似于Hive CLI)。

远程模式中,通过Thrift协议连接到一个不同的HiveServer2。从Hive 0.14起,Beeline连接HiveServer2 时,还会将HiveServer2 执行查询的日志信息输出到STDERR。

-- 推荐在生产中使用远程模式,因为更安全,且无需 HDFS/metastore 的访问授权。

注意,在远程模式下,HiveServer2 只接受有效的Thrift 请求 -- 就算是在HTTP模式中,消息体也需要包含Thrift payload。

Beeline 的使用示例

[root@elephant ~]# beeline
Beeline version 1.1.0-cdh5.6.0 by Apache Hive
beeline> help
!all Execute the specified SQL against all the current connections
!autocommit Set autocommit mode on or off
!batch Start or execute a batch of statements
!brief Set verbose mode off
!call Execute a callable statement
!close Close the current connection to the database
!closeall Close all current open connections
!columns List all the columns for the specified table
!commit Commit the current transaction (if autocommit is off)
!connect Open a new connection to the database.
!dbinfo Give metadata information about the database
!describe Describe a table
!dropall Drop all tables in the current database
!exportedkeys List all the exported keys for the specified table
!go Select the current connection
!help Print a summary of command usage
!history Display the command history
!importedkeys List all the imported keys for the specified table
!indexes List all the indexes for the specified table
!isolation Set the transaction isolation for this connection
!list List the current connections
!manual Display the BeeLine manual
!metadata Obtain metadata information
!nativesql Show the native SQL for the specified statement
!nullemptystring Set to true to get historic behavior of printing null as
empty string. Default is false.
!outputformat Set the output format for displaying results
(table,vertical,csv2,dsv,tsv2,xmlattrs,xmlelements, and
deprecated formats(csv, tsv))
!primarykeys List all the primary keys for the specified table
!procedures List all the procedures
!properties Connect to the database specified in the properties file(s)
!quit Exits the program
!reconnect Reconnect to the database
!record Record all output to the specified file
!rehash Fetch table and column names for command completion
!rollback Roll back the current transaction (if autocommit is off)
!run Run a script from the specified file
!save Save the current variabes and aliases
!scan Scan for installed JDBC drivers
!script Start saving a script to a file
!set Set a beeline variable
!sh Execute a shell command
!sql Execute a SQL command
!tables List all the tables in the database
!typeinfo Display the type map for the current connection
!verbose Set verbose mode on Comments, bug reports, and patches go to ???
beeline> !connect jdbc:hive2://localhost:10000
beeline> !tables;
No current connection
beeline> !connect jdbc:hive2://elephant:10000
scan complete in 2ms
Connecting to jdbc:hive2://elephant:10000
Enter username for jdbc:hive2://elephant:10000: hive
Enter password for jdbc:hive2://elephant:10000: **********
Connected to: Apache Hive (version 1.1.0-cdh5.6.0)
Driver: Hive JDBC (version 1.1.0-cdh5.6.0)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://elephant:10000>

上面,通过help查询了Beeline 支持的命令,又通过 !connect jdbc:hive2://elephant:10000 连接到 elephant主机上的HiveServer2。

下面就来看看还能执行什么操作。

参考:

https://cwiki.apache.org//confluence/display/Hive/HiveServer2+Clients

http://blog.csdn.net/huanggang028/article/details/44591663

Hive Beeline 官方文档学习的更多相关文章

  1. Spring 4 官方文档学习(十二)View技术

    关键词:view technology.template.template engine.markup.内容较多,按需查用即可. 介绍 Thymeleaf Groovy Markup Template ...

  2. Spring 4 官方文档学习(十一)Web MVC 框架之配置Spring MVC

    内容列表: 启用MVC Java config 或 MVC XML namespace 修改已提供的配置 类型转换和格式化 校验 拦截器 内容协商 View Controllers View Reso ...

  3. Spring Data Commons 官方文档学习

    Spring Data Commons 官方文档学习   -by LarryZeal Version 1.12.6.Release, 2017-07-27 为知笔记版本在这里,带格式. Table o ...

  4. Spring 4 官方文档学习(十一)Web MVC 框架之resolving views 解析视图

    接前面的Spring 4 官方文档学习(十一)Web MVC 框架,那篇太长,故另起一篇. 针对web应用的所有的MVC框架,都会提供一种呈现views的方式.Spring提供了view resolv ...

  5. Spring 4 官方文档学习(十一)Web MVC 框架

    介绍Spring Web MVC 框架 Spring Web MVC的特性 其他MVC实现的可插拔性 DispatcherServlet 在WebApplicationContext中的特殊的bean ...

  6. Spring Boot 官方文档学习(一)入门及使用

    个人说明:本文内容都是从为知笔记上复制过来的,样式难免走样,以后再修改吧.另外,本文可以看作官方文档的选择性的翻译(大部分),以及个人使用经验及问题. 其他说明:如果对Spring Boot没有概念, ...

  7. Spring Framework 官方文档学习(四)之Validation、Data Binding、Type Conversion(一)

    题外话:本篇是对之前那篇的重排版.并拆分成两篇,免得没了看的兴趣. 前言 在Spring Framework官方文档中,这三者是放到一起讲的,但没有解释为什么放到一起.大概是默认了读者都是有相关经验的 ...

  8. Spring Framework 官方文档学习(四)之Validation、Data Binding、Type Conversion(二)

    接前一篇 Spring Framework 官方文档学习(四)之Validation.Data Binding.Type Conversion(一) 本篇主要内容:Spring Type Conver ...

  9. Spring boot官方文档学习(一)

    个人说明:本文内容都是从为知笔记上复制过来的,样式难免走样,以后再修改吧.另外,本文可以看作官方文档的选择性的翻译(大部分),以及个人使用经验及问题. 其他说明:如果对Spring Boot没有概念, ...

随机推荐

  1. 漫游Kafka之过期数据清理【转】

    转自:http://blog.csdn.net/honglei915/article/details/49683065 Kafka将数据持久化到了硬盘上,允许你配置一定的策略对数据清理,清理的策略有两 ...

  2. 【Acm】算法之美—Jugs

    题目概述:Jugs In the movie "Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted wi ...

  3. Python处理大数据

    起因 Python处理一下数据,大概有六七个G,然后再存到另外一个文件中,单线程跑起来发现太慢了,数据总量大概是千万行的级别,然后每秒钟只能处理不到20行--遂想怎么提高一下速度 尝试1-multip ...

  4. FFmpeg filter简介

    [时间:2016-08] [状态:Open] [关键词:FFmpeg, filter, filter graph,命令行] 1. 引言及示例 FFmpeg中的libavfilter提供了一整套的基于f ...

  5. idea Error:(1, 10) java: 需要class, interface或enum, 未结束的字符串文字,Error:(55, 136) java: 非法字符: \65533

    1.未结束的字符串文字,Error:(55, 136) java: 非法字符: \65533  这些乱七吧八遭的错误如果很多的话 , 尝试 重新修改下生成目录 修改下语言等级 上述方法都不行 ,还报错 ...

  6. JIRA REST java client API实际应用

    [本文出自天外归云的博客园] 前提 1.需要安装maven环境: 2.在本地创建maven项目并修改maven配置文件“pom.xml”,添加如下内容: <dependency> < ...

  7. windows下html2jade批量转换

    将项目中的代码转换为jade,使用html2jade批量转换 @echo off SETLOCAL ENABLEDELAYEDEXPANSION for %%i in (*.html) do ( ht ...

  8. OpenStack云计算(一)——OpenStack 网络

    关于OpenStack OpenStack它是 Rackspace Cloud 和 NASA 负责的一个开源基础架构即服务的云计算项目. OpenStack 是一个由开发者和云计算技术人员的全球协作开 ...

  9. JAVA-JSP内置对象之exception对象用来处理错误异常

    相关资料:<21天学通Java Web开发> exception对象1.exception对象用来处理错误异常.2.如果要使用exception对象,必须指定page中的isErrorPa ...

  10. Eigen教程(9)

    整理下Eigen库的教程,参考:http://eigen.tuxfamily.org/dox/index.html Eigen并没有为matrix提供直接的Reshape和Slicing的API,但是 ...