一、hive

[root@mihaoyu151 conf]# hive
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/opt/soft/jdk180/bin:/opt/soft/zookeeper345/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/jdk180/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/zookeeper345/bin:/opt/soft/hive110/bin)
21/11/09 13:56:01 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
21/11/09 13:56:01 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.user does not exist
21/11/09 13:56:01 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.password does not exist

Logging initialized using configuration in jar:file:/opt/soft/hive110/lib/hive-common-1.1.0-cdh5.14.2.jar!/hive-log4j.properties
WARNING: Hive CLI is deprecated and migration to Beeline is recommended.
hive> show databases;
OK
default
Time taken: 4.195 seconds, Fetched: 1 row(s)
hive> exit;

二、beeline

第一种

[root@mihaoyu151 conf]# hive --service hiveserver2
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/opt/soft/jdk180/bin:/opt/soft/zookeeper345/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/jdk180/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/zookeeper345/bin:/opt/soft/hive110/bin)
21/11/09 11:09:22 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
21/11/09 11:09:22 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.user does not exist
21/11/09 11:09:22 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.password does not exist

另开一个会话

[root@mihaoyu151 conf]# beeline -u jdbc:hive2://192.168.133.151:10000
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/opt/soft/jdk180/bin:/opt/soft/zookeeper345/bin:/opt/soft/hadoop26/sbin:/opt/soft/hadoop260/bin:/opt/soft/jdk180/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/zookeeper345/bin:/opt/soft/hive110/bin)
scan complete in 1ms
Connecting to jdbc:hive2://192.168.133.151:10000
Connected to: Apache Hive (version 1.1.0-cdh5.14.2)
Driver: Hive JDBC (version 1.1.0-cdh5.14.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.1.0-cdh5.14.2 by Apache Hive
0: jdbc:hive2://192.168.133.151:10000> show databases;
INFO  : Compiling command(queryId=root_20211109110101_d9435f2b-d37f-4d00-bd9c-7bedefa15ddd): show databases
INFO  : Semantic Analysis Completed
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20211109110101_d9435f2b-d37f-4d00-bd9c-7bedefa15ddd); Time taken: 0.567 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20211109110101_d9435f2b-d37f-4d00-bd9c-7bedefa15ddd): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20211109110101_d9435f2b-d37f-4d00-bd9c-7bedefa15ddd); Time taken: 0.027 seconds
INFO  : OK
+----------------+--+
| database_name  |
+----------------+--+
| default        |
+----------------+--+
1 row selected (0.932 seconds)
0: jdbc:hive2://192.168.133.151:10000>

第二种后台启动

[root@mihaoyu151 conf]nohup ../bin/hive --service hiveserver2 &
[1] 5252
[root@mihaoyu151 conf]# nohup: ignoring input and appending output to ‘nohup.out’

直接回车

[root@mihaoyu151 conf]# jps
2464 NodeManager
1938 NameNode
5252 RunJar
5332 Jps
2057 DataNode
2346 ResourceManager
2206 SecondaryNameNode

[root@mihaoyu151 conf]# beeline -u jdbc:hive2://192.168.133.151:10000
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/opt/soft/jdk180/bin:/opt/soft/zookeeper345/bin:/opt/soft/hadoop26/sbin:/opt/soft/hadoop260/bin:/opt/soft/jdk180/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/zookeeper345/bin:/opt/soft/hive110/bin)
scan complete in 1ms
Connecting to jdbc:hive2://192.168.133.151:10000
Connected to: Apache Hive (version 1.1.0-cdh5.14.2)
Driver: Hive JDBC (version 1.1.0-cdh5.14.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.1.0-cdh5.14.2 by Apache Hive
0: jdbc:hive2://192.168.133.151:10000> show databases;
INFO  : Compiling command(queryId=root_20211109110606_930f6b21-ffdc-4ae5-a7ff-b07f991881e7): show databases
INFO  : Semantic Analysis Completed
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20211109110606_930f6b21-ffdc-4ae5-a7ff-b07f991881e7); Time taken: 0.046 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20211109110606_930f6b21-ffdc-4ae5-a7ff-b07f991881e7): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20211109110606_930f6b21-ffdc-4ae5-a7ff-b07f991881e7); Time taken: 0.017 seconds
INFO  : OK
+----------------+--+
| database_name  |
+----------------+--+
| default        |
+----------------+--+
1 row selected (0.154 seconds)
0: jdbc:hive2://192.168.133.151:10000>
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐