91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

hadoop的Hive實戰操作sogou的日志

發布時間:2020-07-09 12:50:38 來源:網絡 閱讀:996 作者:moviebat 欄目:大數據

動手實戰操作搜狗日志文件

本節中所用到的內容是來自搜狗實驗室,網址為:

http://www.sogou.com/labs/dl/q.html

用戶可以根據自己的Spark機器實際的內存配置等情況選擇下載不同的數據版本,為了讓所有的學習者都可以成功操作日志,我們使用的是迷你版本的tar.gz格式的文件,其大小為384K,下載地址:http://www.sogou.com/labs/resource/q.php

日志格式如下:

單挑記錄:

00:00:00 2982199073774412 [360安全衛士] 8 3 download.it.com.cn/softweb/software/firewall/antivirus/20067/17938.html


該文件的格式如下所示:

訪問時間\t用戶ID\t查詢詞\t該URL在返回結果中的排名\t用戶點擊的順序號\t用戶點擊的URL

在hive中創建表格:

create table sogou(sTime string,userId string,Keyword string,Paiming int,Dianji int,URL string) row format delimited 

fields terminated by '\t' lines terminated by '\n' stored as textfile

結果如下:

hive> create table sogou(sTime string,userId string,Keyword string,Paiming int,Dianji int,URL string) row format delimited 

    > fields terminated by '\t' lines terminated by '\n' stored as textfile;

OK

Time taken: 4.422 seconds


導入數據:

load data local inpath  '/home/dyq/Documents/SogouQ.sample' overwrite into table sogou;

結果顯示:

hive> load data local inpath  '/home/dyq/Documents/SogouQ.sample' overwrite into table sogou;

Loading data to table default.sogou

OK

Time taken: 3.567 seconds


查看表的建立情況:

hive> desc sogou;

OK

stime               string                                  

userid               string                                  

keyword             string                                  

paiming             int                                    

dianji               int                                    

url                 string                                  

Time taken: 2.515 seconds, Fetched: 6 row(s)

查看數據導入情況:


查看記錄條數:

select count(*) from sogou;

可以看到查詢過程很漫長,效率不高的說

hive> select count(*) from sogou;

WARNING: Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. tez, spark) or using Hive 1.X releases.

Query ID = dyq_20160828114648_be63db30-cce4-47f0-aa1d-2e0f626c274c

Total jobs = 1

Launching Job 1 out of 1

Number of reduce tasks determined at compile time: 1

In order to change the average load for a reducer (in bytes):

  set hive.exec.reducers.bytes.per.reducer=<number>

In order to limit the maximum number of reducers:

  set hive.exec.reducers.max=<number>

In order to set a constant number of reducers:

  set mapreduce.job.reduces=<number>

Starting Job = job_1472347049416_0004, Tracking URL = http://ubuntu:8088/proxy/application_1472347049416_0004/

Kill Command = /opt/hadoop-2.6.2/bin/hadoop job  -kill job_1472347049416_0004

Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1

2016-08-28 11:47:28,067 Stage-1 map = 0%,  reduce = 0%

2016-08-28 11:48:09,628 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 8.1 sec

2016-08-28 11:48:35,383 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 10.68 sec

MapReduce Total cumulative CPU time: 10 seconds 680 msec

Ended Job = job_1472347049416_0004

MapReduce Jobs Launched: 

Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 10.68 sec   HDFS Read: 906303 HDFS Write: 105 SUCCESS

Total MapReduce CPU Time Spent: 10 seconds 680 msec

OK

10000

Time taken: 109.492 seconds, Fetched: 1 row(s)


導出數據到外部文件

insert overwrite local directory '/home/dyq/Documents/SogouQdept' select a.Keyword,a.URL from sogou a; 


只導出2個字段,看看情況


hive> insert overwrite local directory '/home/dyq/Documents/SogouQdept' select a.Keyword,a.URL from sogou a; 

WARNING: Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. tez, spark) or using Hive 1.X releases.

Query ID = dyq_20160828115140_2bc274b4-7845-46c2-9ac7-e45fcc5b7b23

Total 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_1472347049416_0005, Tracking URL = http://ubuntu:8088/proxy/application_1472347049416_0005/

Kill Command = /opt/hadoop-2.6.2/bin/hadoop job  -kill job_1472347049416_0005

Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0

2016-08-28 11:51:54,594 Stage-1 map = 0%,  reduce = 0%

2016-08-28 11:52:06,398 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 3.14 sec

MapReduce Total cumulative CPU time: 3 seconds 140 msec

Ended Job = job_1472347049416_0005

Moving data to local directory /home/dyq/Documents/SogouQdept

MapReduce Jobs Launched: 

Stage-Stage-1: Map: 1   Cumulative CPU: 3.14 sec   HDFS Read: 901894 HDFS Write: 178503 SUCCESS

Total MapReduce CPU Time Spent: 3 seconds 140 msec

OK

Time taken: 28.859 seconds


查看sogouQdept文件的內容:


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

丽江市| 大埔区| 青浦区| 茶陵县| 汉源县| 平果县| 乡宁县| 荃湾区| 延寿县| 探索| 宁都县| 永清县| 桐柏县| 苗栗市| 建湖县| 马尔康县| 西盟| 朝阳市| 余江县| 漳平市| 嘉鱼县| 汝阳县| 无棣县| 时尚| 彭州市| 延川县| 博白县| 江西省| 石狮市| 盱眙县| 凉山| 旬邑县| 临高县| 千阳县| 荆门市| 通河县| 上思县| 普兰县| 东海县| 正阳县| 吉隆县|