Hive Beeline

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

[trafodion@n12 udr]$ hive
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
OpenJDK 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
17/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.0

Logging 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.properties
WARNING: Hive CLI is deprecated and migration to Beeline is recommended.
hive>

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

[trafodion@n12 udr]$ beeline
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
OpenJDK 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
17/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.0
Beeline version 1.1.0-cdh5.7.2 by Apache Hive
beeline> !connect jdbc:hive2://n11:10000/default
scan complete in 3ms
Connecting to jdbc:hive2://n11:10000/default
Enter username for jdbc:hive2://n11:10000/default: hive
Enter 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_READ
0: 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

你可能感兴趣的:(大数据,Hive)