Hive Beeline

来源:互联网 发布:mac unix 可执行文件 编辑:程序博客网 时间:2024/05/14 19:08

Beeline是Hive 0.11引入的新的交互式CLI,基于SQLLine,可以作为Hive JDBC Client端访问Hive Server2,启动一个Beeline就是维护一个session。
Hive Server1中我们习惯了用Hive CLI,方式如下,

[trafodion@n12 udr]$ hiveOpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0OpenJDK 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release17/03/10 15:20:22 WARN mapreduce.TableMapReduceUtil: The hbase-prefix-tree module jar containing PrefixTreeCodec is not present.  Continuing without it.OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0Logging initialized using configuration in jar:file:/opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/jars/hive-common-1.1.0-cdh5.7.2.jar!/hive-log4j.propertiesWARNING: Hive CLI is deprecated and migration to Beeline is recommended.hive>

而用Beeline连接Hive则是以下这样,

[trafodion@n12 udr]$ beelineOpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0OpenJDK 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release17/03/10 15:14:30 WARN mapreduce.TableMapReduceUtil: The hbase-prefix-tree module jar containing PrefixTreeCodec is not present.  Continuing without it.OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0Beeline version 1.1.0-cdh5.7.2 by Apache Hivebeeline> !connect jdbc:hive2://n11:10000/defaultscan complete in 3msConnecting to jdbc:hive2://n11:10000/defaultEnter username for jdbc:hive2://n11:10000/default: hiveEnter password for jdbc:hive2://n11:10000/default: ****Connected to: Apache Hive (version 1.1.0-cdh5.7.2)Driver: Hive JDBC (version 1.1.0-cdh5.7.2)Transaction isolation: TRANSACTION_REPEATABLE_READ0: jdbc:hive2://n11:10000/default>

上面的jdbc:hive2://n11:10000/default,即是Hive Connection URL,n11为Hive Server2节点的IP,10000为Hive Server2默认的端口号,default为Hive默认的数据库名称。
关于Beeline命令行的使用,请参考:https://cwiki.apache.org//confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-BeelineExample

1 0
原创粉丝点击