怎么運(yùn)行MapReduce

這篇文章主要講解了“怎么運(yùn)行MapReduce”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“怎么運(yùn)行MapReduce”吧!

創(chuàng)新互聯(lián)建站主要從事網(wǎng)站建設(shè)、做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)百色,十余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來(lái)電咨詢建站服務(wù):18980820575

運(yùn)行MapReduce

代碼打jar包,不要包含依賴,使用maven的默認(rèn)打包工具就行

# ls hdfs的目錄
hadoop dfs -ls /user/hadoop/
# 刪除output 目錄
hadoop dfs rm -f -r /user/hadoop/output
# 新建input
hadoop dfs -mkdir -p /user/hadoop/input
# 從本地文件系統(tǒng)copy 數(shù)據(jù)到hdfs
hadoop dfs -put input_bak/sample.txt /user/hadoop/input
# 運(yùn)行 mapreduce
hadoop jar hadoopdemo.jar MaxTemperature input/sample.txt output
# 查看結(jié)果
hadoop dfs -get /usr/hadoop/output /home/hadoop/
cd /home/hadoop/output
more part-r-00000

##采坑

  • hadoop 2.x hadoop 3.x API變化大,不兼容

  • hadoop 配置 mapred-site.xml

  • 數(shù)據(jù)文件要上傳到hdfs

  • 額,hdfs 常用命令

      (1)查看幫助
          hdfs dfs -help 
      (2)查看當(dāng)前目錄信息
          hdfs dfs -ls /
          
      (3)上傳文件
          hdfs dfs -put /本地路徑 /hdfs路徑
          
      (4)剪切文件
          hdfs dfs -moveFromLocal a.txt /aa.txt
          
      (5)下載文件到本地
          hdfs dfs -get /hdfs路徑 /本地路徑
          
      (6)合并下載
          hdfs dfs -getmerge /hdfs路徑文件夾 /合并后的文件
          
      (7)創(chuàng)建文件夾
          hdfs dfs -mkdir /hello
          
      (8)創(chuàng)建多級(jí)文件夾
          hdfs dfs -mkdir -p /hello/world
          
      (9)移動(dòng)hdfs文件
          hdfs dfs -mv /hdfs路徑 /hdfs路徑
          
      (10)復(fù)制hdfs文件
          hdfs dfs -cp /hdfs路徑 /hdfs路徑
          
      (11)刪除hdfs文件
          hdfs dfs -rm /aa.txt
          
      (12)刪除hdfs文件夾
          hdfs dfs -rm -r /hello
          
      (13)查看hdfs中的文件
          hdfs dfs -cat /文件
          hdfs dfs -tail -f /文件
          
      (14)查看文件夾中有多少個(gè)文件
          hdfs dfs -count /文件夾
          
      (15)查看hdfs的總空間
          hdfs dfs -df /
          hdfs dfs -df -h /
          
      (16)修改副本數(shù)    
          hdfs dfs -setrep 1 /a.txt

感謝各位的閱讀,以上就是“怎么運(yùn)行MapReduce”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)怎么運(yùn)行MapReduce這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

網(wǎng)站標(biāo)題:怎么運(yùn)行MapReduce
文章出自:http://bm7419.com/article38/ijhesp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、品牌網(wǎng)站制作、定制網(wǎng)站、微信小程序、微信公眾號(hào)、網(wǎng)頁(yè)設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站