顯示具有 hadoop 標籤的文章。 顯示所有文章
顯示具有 hadoop 標籤的文章。 顯示所有文章

2016年2月19日 星期五

一些與hadoop有關的命令記錄

直接對同機台上另一個帳號下命令

su hdfs -c '~/hdfs/sbin/stop-dfs.sh'

使用hadoop streaming

bin/hadoop jar share/hadoop/tools/lib/hadoop-streaming-2.7.1.jar \
    -input /usr/ctfan/input01 \
    -output /usr/ctfan/output/folder \
    -mapper mapper.py \
    -reducer reducer.py \
    -file ~/ctfan/pyStreaming/mapper.py \
    -file ~/ctfan/pyStreaming/reducer.py

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:
        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 current_word == word:
    print '%s\t%s' % (current_word, current_count)

單機測試streaming命令

echo 'a b c a b' | ./mapper.py | sort -k1,1 | ./reducer.py

參考網頁

hadoop官方文件
Michael G. Noll's Blog

2015年11月20日 星期五

Installation procedures of Hadoop 2.7.1

A Windows 7 computer with Oracle VM VirtualBox installed is exploited.  Within VirtualBox, Ubuntu 14.04.3 is installed on each VM created.
The following are the procedures of installing hadoop version 2.7.1.

2015年11月13日 星期五

Setup VM's static IP with VMWare Workstation 12 Player

I was intended to setup a hadoop cluster using VMWare.  But setting up a static IP to a VM is kind of hard.  I felt hard to understand what the networking structure provided by VMWare.

2013年4月8日 星期一

最近 hadoop 的感想


不知道有多少人裝過 hadoop,尤其是在多台機器上,來產生一個 Cluster。一堆電腦幫忙做事情,總是比一台電腦快多了。

2013年2月16日 星期六

Install Ubuntu 12.04 + hadoop 1.0 on Xen server

This article setup a hadoop cluster on Xen, with Ubuntu 12.04 installed.  Only simple description is shown here.  For more other information, console the documents and Google for the answers.

2012年9月29日 星期六

Re-install Cluster on Xen 6.0.2

As title, just because we updated Xen to version 6.0.2 .
Following is some problems faced while installing.

Note that the following things should be install as a "Base System" that can be cloned to make new VM.

  1. Java Environment
  2. Jade Environment
  3. Hadoop Enviornment

Note that Hadoop setup procedure is not written in this article.

2011年5月1日 星期日

java.io.IOException: org.apache.hadoop.fs.FSError: java.io.IOException: No space left on device

If you got following problem:

java.io.IOException: org.apache.hadoop.fs.FSError: java.io.IOException: No space left on device

This means that your space is running out.  Usually the /tmp space

To make more space, one is to add /tmp's space

Or there is another option: Set hadoop.tmp.dir in conf/core-site.xml to /home/hadoop/tmp


That is the easiest way to extend the space

2010年12月15日 星期三

Setup Hadoop with Clonezilla

This is a log that I used to install a Hadoop in Ubuntu, using with Clonezilla to quick install many computer.