欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

hadoop分布式集群部署以及過程中遇到的一些坑

在hadoop學(xué)習過程中,首先第一步是部署偽分布以及分布式集群。
在集群的部署過程中http://www.powerxing.com/install-hadoop-cluster/
使用這篇博客作為參考。

創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比絳縣網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式絳縣網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋絳縣地區(qū)。費用合理售后完善,十載實體公司更值得信賴。

在部署過程中。 遇到一些問題。
比如:用PYTHON 跑一個簡單的MAPREDUCE 任務(wù),首先需要現(xiàn)在streamingJAR包,簡單的說這個包封裝了一些常用的接口,PYTHON 通過標準輸入輸出來調(diào)用這個包。最終完成在內(nèi)部用JAVA實現(xiàn)的功能。
下載地址為:http://www.java2s.com/Code/JarDownload/hadoop-streaming/

python 程序為 mapper.py

#!/usr/bin/env python
import sys
for line in sys.stdin:
line = line.strip()
words = line.split()
for word in words:
print "%s\t%s" % (word, 1)

以及reducer.py

**#!/usr/bin/env python
from operator import itemgetter
import sys

current_word = None
current_count = 0
word = None

for line in sys.stdin:
line = line.strip()
word, count = line.split('\t', 1)
try:
count = int(count)
except ValueError: #count如果不是數(shù)字的話,直接忽略掉
continue
if current_word == word:
current_count += count
else:
if current_word:
print "%s\t%s" % (current_word, current_count)
current_count = count
current_word = word

if word == current_word: #不要忘記最后的輸出
print "%s\t%s" % (current_word, current_count)**

    運行方式:
hadoop jar ./hadoop-streaming-2.6.0.jar -file ./mappper.py -file ./reducer.py  -input /input -output /output

這里需要注意的是  /input 必須放在hadoop文件系統(tǒng)上
hadoop fs -put input /input 
/output 不能存在,如果存在請先刪除

另外在python中首行必須寫   #!/usr/bin/env python
否則可能會報錯。具體原因可以看http://andylue2008.iteye.com/blog/1622260  這篇博客

另外如果使用hadoop fs -ls 這樣的命令報錯: 找不到ls目錄。是因為沒有創(chuàng)建家目錄
hadoop fs -mkdir -p /user/hadoop

文章標題:hadoop分布式集群部署以及過程中遇到的一些坑
文章起源:http://www.chinadenli.net/article22/igpojc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版關(guān)鍵詞優(yōu)化品牌網(wǎng)站建設(shè)靜態(tài)網(wǎng)站網(wǎng)站排名

廣告

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

成都網(wǎng)頁設(shè)計公司