Find records contianing IP address using MapReduce Streaming

The python code is named as “”, which outputs every line containing IP address. The delimiter of each line is a single space.


import sys
import socket

for line in sys.stdin:
 fields = line.strip().split(" ")
 value = fields[len(fields)-1]
 print line.strip()
 except socket.error:

Run the code:

hadoop@fxu-t60:/usr/local/hadoop$ bin/hadoop jar contrib/streaming/hadoop-0.20.2-streaming.jar -D mapred.reduce.tasks=1 -input /home/hadoop/tld -output /home/hadoop/tld-ipĀ  -mapper '' -file ~/Desktop/data/TLD/

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s