进入hive

 

[root@node129 bin]# hive
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

Logging initialized using configuration in jar:file:/home/console/hive/lib/hive-common-2.1.1-cdh6.1.1.jar!/hive-log4j2.properties Async: false

WARNING: Hive CLI is deprecated and migration to Beeline is recommended.

 



创建数据库
hive> create database hive;
OK
Time taken: 4.805 seconds
hive> show databases;
OK
default
dqe_echo
dqe_sakila
hive
test_dqe
Time taken: 0.201 seconds, Fetched: 5 row(s)
hive> use hive;
OK
Time taken: 0.058 seconds

hive> use hive;
OK
Time taken: 0.058 seconds

 




创建数据表
hive> create table usr(id int,name string,age int);
OK
Time taken: 0.969 seconds
hive> show tables;
OK
usr
Time taken: 0.194 seconds, Fetched: 1 row(s)

 




插入数据
hive> insert into usr values(1,'jack',22);
Query ID = root_20191119173853_1ad89220-23f7-43d2-8016-ad88568b5a81
Total jobs = 3
Launching Job 1 out of 3
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_1573734042476_0001, Tracking URL = http://node128:8088/proxy/application_1573734042476_0001/
Kill Command = /home/console/hadoop/hadoop/bin/hadoop job  -kill job_1573734042476_0001
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
2019-11-19 17:39:30,044 Stage-1 map = 0%,  reduce = 0%
2019-11-19 17:40:16,483 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 6.43 sec
MapReduce Total cumulative CPU time: 6 seconds 430 msec
Ended Job = job_1573734042476_0001
Stage-4 is selected by condition resolver.
Stage-3 is filtered out by condition resolver.
Stage-5 is filtered out by condition resolver.
Moving data to directory hdfs://nameservice1/user/hive/warehouse/hive.db/usr/.hive-staging_hive_2019-11-19_17-38-53_689_8783530819797612524-1/-ext-10000
Loading data to table hive.usr
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 1   Cumulative CPU: 6.43 sec   HDFS Read: 4407 HDFS Write: 74 HDFS EC Read: 0 SUCCESS
Total MapReduce CPU Time Spent: 6 seconds 430 msec
OK
Time taken: 86.97 seconds

 




查询数据

hive> select * from usr;
OK
1    jack    22
Time taken: 0.091 seconds, Fetched: 1 row(s)

 



  

posted on 2019-11-20 15:30  li7  阅读(1175)  评论(0编辑  收藏  举报