hiveserver2 和beeline_Hive 的 hiveserver2 和 beeline 使用

组件介绍Hive 开启了 hiveserver2 才能远程连接到 Hive

hiveserver2 : 可以理解为一个 服务端

beeline : 可以理解为一个 客户端

# 它们在 Hive 的 bin/ 目录下

[root@master bin]# ll

总用量 32

-rwxr-xr-x. 1 root root 1031 4月 1 2017 beeline

drwxr-xr-x. 3 root root 4096 12月 26 16:43 ext

-rwxr-xr-x. 1 root root 7844 4月 1 2017 hive

-rwxr-xr-x. 1 root root 1900 1月 8 2016 hive-config.sh

-rwxr-xr-x. 1 root root 885 1月 8 2016 hiveserver2

-rwxr-xr-x. 1 root root 832 1月 8 2016 metatool

-rwxr-xr-x. 1 root root 884 1月 8 2016 schematool

小测试搭建的是 Hadoop 伪分布式进行测试

开启两个窗口,一个运行 hiveserver2 ,另一个运行 beeline

运行 hiveserver2 当做服务端 下图这样挂住就算开启

另一个窗口执行 beeline 当做客户端,当然客户端不一定是 beeline ,还能是其他的一些客户端,但连接的地址、用户名、密码是一个道理

连接 Hive ,进行查询 连接地址:!connect jdbc:hive2://master:10000

拓展beeline 的所有命令

0: jdbc:hive2://master:10000> help

!addlocaldriverjar Add driver jar file in the beeline client side.

!addlocaldrivername Add driver name that needs to be supported in the beeline

client side.

!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 ???

0: jdbc:hive2://master:10000>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值