




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
HadoopA.hadoopip地址,ip3臺虛名機分別執(zhí)行編輯命令,然后唯一的區(qū)別就是名字,hadoop1,C.3hosts文件命令為:vi/etc/hostsE:關閉,虛擬機環(huán)境已集主節(jié)點(hadoop1):配置為時間服務器,yumntp.從節(jié)點(hadoop2,hadoop3)hadoop1的配置(虛擬機環(huán)境已集成hadoophadoophadoopHive安裝mysqlHive元數mysql-uroot-最后一步就是新建hive數據庫,用于hive元數將mysql連接驅動包放到hive安裝路徑的 下,mysql包在hadoop-install錄啟動hive之前,先進行hive元數據初始化:schematooldbTypemysqlHive數據createdatabaseraw_test;usehiveshop1,shop2shop1,shop2數據源字段屬性從左往右分別是:id,商品名稱,商品額,商品數量,商品時createtabletable_name(idint,goods_namestring,biz_pricedouble,count rowformatdelimitedfieldsterminatedby';'storedastextfile;txtterminatedbytable_nameshop1,shop2,分兩次執(zhí)行.loaddatalocalinpath'/root/file_name.txt'intotable這里的'/root/file_name.txttxtfile_nameshop1,shop2,執(zhí)行兩次,table_nameraw_testshop1,shop2shop1_1,shop1_2,shop2_1createtabletable_name(idint,goods_namestring,biz_pricedouble,count rowformatdelimitedfieldsterminatedby';'storedastextfile;table_nameshop1_1的要求為過濾金額為負數或者數量為負數的記錄,語句如下:insertoverwritetableshop1_1selectrow_number()over(orderbyunix_timestamp(biz_date)asc)asid,fromwherebiz_price>=0orcount>=selectcount(*)fromshop1_2的要求為過濾掉屬性有空的記錄,語句如下:insertoverwritetableshop1_2selectrow_number()over(orderbyunix_timestamp(biz_date)asc)asid,fromwhereidisnotnullandgoods_name!=andbiz_priceisnotnullandcountisnotnullandbiz_date!='';selectcount(*)frominsertoverwritetableselectrow_number()over(orderbyunix_timestamp(biz_date)asc)asfromshop2groupbyselectcount(*)fromSpark操(進入spark安 ,/opt/spark-2.3.1/bin輸入spark-sql進入交互環(huán)境Spark-sqlmovie庫,moviecreatedatabasemovie;usemovie;movie庫創(chuàng)建movie_top250,并將桌面top250_f1.csv數據源導入到movie_top250中string,genrestring,rating_num mentstring,urlstring)rowformatfieldsterminatedby'\t'storedastextfile;loaddatalocalinpath'/root/top250_f1.txt'intotableselect*frommovie_top250limit5部selectnum, frommovie_top250orderbycomment_numdesclimit5;統(tǒng)計2013年以后產量最多的5個地selecta.area,count(a.num)asmovie_count selectnum,area,init_yearfrommovie_top250whereinit_year>=groupbyareaorderbymovie_countdesclimit統(tǒng)計評分和評論系數最高,且類別為愛情和劇情的前10部selecttitle,a ment_num,(rating_num*comment_num)asflagfrommovie_top250wheregenrelike劇情%愛情orgenrelike愛情%劇情%'orderbyflagdesclimit10;weather庫,weathercreatedatabaseweather;useweather;weather表createtableweather(happen_datestring,weather_conditionstring,highest_temperatureint,minimum_temperatureint,wind_directionstring)rowformatfieldsterminatedbystoredasweatherweather20189月份每天的最高溫度selecthappen_date,highest_temperature,minimum_temperaturefromweatherwhereyear(happen_date)=2018andmonth(happen_date)=9Echarts實例代碼(3).2016年,selectcount(*),weather_conditionaswcfromweatherwhereyear(happen_date)=2016groupbyweathe
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- T-ZSA 232-2024 特種巡邏機器人通.用技術要求
- T-ZJHQ 0003-2024 高等學校生活垃圾分類工作規(guī)范
- 2025年度電子商務平臺數據分析與報告合同模板
- 二零二五年度解除婚約合同范本:婚約解除后的財產清算、債務處理及子女監(jiān)護協(xié)議
- 2025年度鋼板租賃與回收利用合同
- 二零二五年度金融機構資金轉入風險管理合同
- 2025年度智慧能源管理系統(tǒng)擔保人履約保證合同
- 二零二五年度企業(yè)綠色金融項目補貼協(xié)議
- 二零二五年度情人協(xié)議書:浪漫愛情生活規(guī)劃合同范本
- 石壕吏:歷史背景與社會問題分析教學教案
- 《中華人民共和國學前教育法》專題培訓
- 濕式氣柜培訓
- 2023年高考真題-化學(福建卷) 含解析
- 欄桿拆除及更換施工方案
- 10我們愛和平(第1課時)(說課稿)2023-2024學年統(tǒng)編版道德與法治六年級下冊
- 《國際貿易實務(英文版)》(英文課件) -Ch 6 International Cargo Transport-Ch 11 Cross-border Commerce
- 新條令.新亮點-內務條令解讀
- 中醫(yī)適宜技術-中藥熱奄包
- 林海雪原課件6張
- 銀發(fā)經濟產業(yè)發(fā)展規(guī)劃
- 防火涂料質量保證書
評論
0/150
提交評論