hive启动后相关操作

时间:2022-05-06
本文章向大家介绍hive启动后相关操作,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
   hadoop@ubuntu118:~$ $HIVE_HOME/bin/hive  
   WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.  
   Logging initialized using configuration in jar:file:/home/hadoop/hive-0.8.1-bin/lib/hive-common-0.8.1.jar!/hive-log4j.properties  
   Hive history file=/tmp/hadoop/hive_job_log_hadoop_201208291807_723168203.txt  
   hive> show tables;  
   OK  
   Time taken: 4.076 seconds  
   hive> create table tt(id int, name string) row format delimited fields terminated by 't';  
   OK  
   Time taken: 0.193 seconds  
   hive> show tables;  
   OK  
   tt  
   Time taken: 0.082 seconds  
   hive> select name from tt;  
   Total MapReduce jobs = 1  
   Launching Job 1 out of 1  
   Number of reduce tasks is set to 0 since there's no reduce operator  
   Starting Job = job_201208291803_0001, Tracking URL = http://ubuntu118:50030/jobdetails.jsp?jobid=job_201208291803_0001  
   Kill Command = /home/hadoop/hadoop-1.0.2/libexec/../bin/hadoop job  -Dmapred.job.tracker=192.168.0.118:9001 -kill job_201208291803_0001  
   Hadoop job information for Stage-1: number of mappers: 0; number of reducers: 0  
   2012-08-29 18:31:00,383 Stage-1 map = 0%,  reduce = 0%  
   2012-08-29 18:31:06,404 Stage-1 map = 100%,  reduce = 100%  
   Ended Job = job_201208291803_0001  
   MapReduce Jobs Launched:   
   Job 0:  HDFS Read: 0 HDFS Write: 0 SUCESS  
   Total MapReduce CPU Time Spent: 0 msec  
   OK  
   Time taken: 18.233 seconds  
   hive> dfs -ls /user/hive/warehouse/;  
   Found 1 items  
   drwxr-xr-x   - hadoop supergroup          0 2012-08-29 18:30 /user/hive/warehouse/tt  
   hive> dfs -ls /user/hive/warehouse/;  
   Found 1 items  
   drwxr-xr-x   - hadoop supergroup          0 2012-08-29 18:30 /user/hive/warehouse/tt  
   hive> exit;  
   hadoop@ubuntu118:~$ mysql -uroot -p  
   Enter password:   
   Welcome to the MySQL monitor.  Commands end with ; or g.  
   Your MySQL connection id is 38  
   Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)  
   Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.  
   Oracle is a registered trademark of Oracle Corporation and/or its  
   affiliates. Other names may be trademarks of their respective  
   owners.  
   Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.  
   mysql> use hive;  
   Reading table information for completion of table and column names  
   You can turn off this feature to get a quicker startup with -A  
   Database changed  
   mysql> show tables;  
   +-----------------+  
   | Tables_in_hive  |  
   +-----------------+  
   | BUCKETING_COLS  |  
   | CDS             |  
   | COLUMNS_V2      |  
   | DATABASE_PARAMS |  
   | DBS             |  
   | PARTITION_KEYS  |  
   | SDS             |  
   | SD_PARAMS       |  
   | SEQUENCE_TABLE  |  
   | SERDES          |  
   | SERDE_PARAMS    |  
   | SORT_COLS       |  
   | TABLE_PARAMS    |  
   | TBLS            |  
   | t               |  
   +-----------------+  
   15 rows in set (0.00 sec)  
   mysql> select * from TBLS;  
   +--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+  
   | TBL_ID | CREATE_TIME | DB_ID | LAST_ACCESS_TIME | OWNER  | RETENTION | SD_ID | TBL_NAME | TBL_TYPE      | VIEW_EXPANDED_TEXT | VIEW_ORIGINAL_TEXT |  
   +--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+  
   |      1 |  1346290224 |     1 |                0 | hadoop |         0 |     1 | tt       | MANAGED_TABLE | NULL               | NULL               |  
   +--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+  
   1 row in set (0.00 sec)