Hive Cli相关操作

landen@Master:~/UntarFile/hive-0.10.0$ bin/hive --database 'stuchoosecourse' -e 'select * from hiddenipinfo'
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/landen/UntarFile/hive-0.10.0/lib/hive-common-0.10.0.jar!/hive-log4j.properties
Hive history file=/home/landen/UntarFile/hive-0.10.0/logs/hive_job_log_landen_201312091443_1939478442.txt
OK
Time taken: 2.704 seconds
OK
ip    countrycode    countryname    region    regionname    city    latitude    longitude    timezone
221.12.10.218    CN    China    02    Zhejiang    Hangzhou    30.293594    120.16141    Asia/Shanghai
60.180.248.201    CN    China    02    Zhejiang    Wenzhou    27.999405    120.66681    Asia/Shanghai
125.111.251.118    CN    China    02    Zhejiang    Ningbo    29.878204    121.5495    Asia/Shanghai
Time taken: 0.813 seconds


testSql.q内容如下:

select IP4Tocc(ipadress,'./GeoLiteCity.dat') from ipidentifier;
select * from hiddenipinfo;

landen@Master:~/UntarFile/hive-0.10.0$ bin/hive --database 'stuchoosecourse' -f '/home/landen/文档/testSql.q'(执行SQL文件)
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/landen/UntarFile/hive-0.10.0/lib/hive-common-0.10.0.jar!/hive-log4j.properties
Hive history file=/home/landen/UntarFile/hive-0.10.0/logs/hive_job_log_landen_201312091450_505292945.txt
OK
Time taken: 4.939 seconds
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_201312042044_0024, Tracking URL = http://Master:50030/jobdetails.jsp?jobid=job_201312042044_0024
Kill Command = /home/landen/UntarFile/hadoop-1.0.4/libexec/../bin/hadoop job  -kill job_201312042044_0024
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
2013-12-09 14:51:19,055 Stage-1 map = 0%,  reduce = 0%
2013-12-09 14:51:25,127 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.21 sec
2013-12-09 14:51:26,133 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.21 sec
2013-12-09 14:51:27,156 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.21 sec
2013-12-09 14:51:28,160 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.21 sec
2013-12-09 14:51:29,164 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.21 sec
2013-12-09 14:51:30,168 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.21 sec
2013-12-09 14:51:31,172 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 1.21 sec
MapReduce Total cumulative CPU time: 1 seconds 210 msec
Ended Job = job_201312042044_0024
MapReduce Jobs Launched:
Job 0: Map: 1   Cumulative CPU: 1.21 sec   HDFS Read: 306 HDFS Write: 188 SUCCESS
Total MapReduce CPU Time Spent: 1 seconds 210 msec
OK
_c0
CN    China    02    Zhejiang    Hangzhou    30.293594    120.16141    Asia/Shanghai
CN    China    02    Zhejiang    Wenzhou    27.999405    120.66681    Asia/Shanghai
CN    China    02    Zhejiang    Ningbo    29.878204    121.5495    Asia/Shanghai
Time taken: 47.517 seconds
OK
ip    countrycode    countryname    region    regionname    city    latitude    longitude    timezone
221.12.10.218    CN    China    02    Zhejiang    Hangzhou    30.293594    120.16141    Asia/Shanghai
60.180.248.201    CN    China    02    Zhejiang    Wenzhou    27.999405    120.66681    Asia/Shanghai
125.111.251.118    CN    China    02    Zhejiang    Ningbo    29.878204    121.5495    Asia/Shanghai
Time taken: 0.441 seconds
landen@Master:~/UntarFile/hive-0.10.0$

hive (stuchoosecourse)> source /home/landen/文档/testSql.q(执行SQL文件);
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_201312042044_0025, Tracking URL = http://Master:50030/jobdetails.jsp?jobid=job_201312042044_0025
Kill Command = /home/landen/UntarFile/hadoop-1.0.4/libexec/../bin/hadoop job  -kill job_201312042044_0025
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
2013-12-09 15:04:16,330 Stage-1 map = 0%,  reduce = 0%
2013-12-09 15:04:25,390 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.39 sec
2013-12-09 15:04:26,420 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.39 sec
2013-12-09 15:04:27,455 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.39 sec
2013-12-09 15:04:28,467 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.39 sec
2013-12-09 15:04:29,470 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.39 sec
2013-12-09 15:04:30,479 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.39 sec
2013-12-09 15:04:31,485 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 2.39 sec
MapReduce Total cumulative CPU time: 2 seconds 390 msec
Ended Job = job_201312042044_0025
MapReduce Jobs Launched:
Job 0: Map: 1   Cumulative CPU: 2.39 sec   HDFS Read: 306 HDFS Write: 188 SUCCESS
Total MapReduce CPU Time Spent: 2 seconds 390 msec
OK
_c0
CN    China    02    Zhejiang    Hangzhou    30.293594    120.16141    Asia/Shanghai
CN    China    02    Zhejiang    Wenzhou    27.999405    120.66681    Asia/Shanghai
CN    China    02    Zhejiang    Ningbo    29.878204    121.5495    Asia/Shanghai
Time taken: 72.463 seconds
OK
ip    countrycode    countryname    region    regionname    city    latitude    longitude    timezone
221.12.10.218    CN    China    02    Zhejiang    Hangzhou    30.293594    120.16141    Asia/Shanghai
60.180.248.201    CN    China    02    Zhejiang    Wenzhou    27.999405    120.66681    Asia/Shanghai
125.111.251.118    CN    China    02    Zhejiang    Ningbo    29.878204    121.5495    Asia/Shanghai
Time taken: 0.133 seconds

hive (default)> add file /home/landen/UntarFile/GeoIP/GeoLiteCity.dat;
Added resource: /home/landen/UntarFile/GeoIP/GeoLiteCity.dat
hive (default)> add jar /home/landen/UntarFile/hive-0.10.0/lib/IPTocc.jar jar1 jar2 ...;
Added /home/landen/UntarFile/hive-0.10.0/lib/IPTocc.jar to class path
Added resource: /home/landen/UntarFile/hive-0.10.0/lib/IPTocc.jar
hive (default)> create temporary function IP4Tocc as 'org.hadoop.hive.additionalUDF.IPToCC';

hive (stuchoosecourse)> list jars;
/home/landen/UntarFile/hive-0.10.0/lib/IPTocc.jar
file:/home/landen/UntarFile/hive-0.10.0/lib/hive-builtins-0.10.0.jar
hive (stuchoosecourse)> show tables '*ip*';
OK
tab_name
hiddenipinfo
ipidentifier
Time taken: 3.727 seconds
hive (stuchoosecourse)>

其它相关hive cli操作:http://www.cnblogs.com/tangtianfly/archive/2012/11/02/2751815.html

 

你可能感兴趣的:(hive)