Database Reference
In-Depth Information
sb.append(status.getText());
sb.append("\n");
try
{
fos.write(sb.toString().getBytes());
}
catch (IOException e)
{
// log error
}
count++;
}
while ((query = result.nextQuery())
!= null );
}
Running this will store a tweets file in the current directory.
The source code for all the examples used in this chapter is available with the
downloads for this topic. The complete source code for the preceding snippet is avail-
able at
com.apress.chapter5.mapreduce.twittercount.hdfs.DefaultTwitterService .
Storing Tweets into HDFS
Next, store tweets into HDFS. You also need to have Hadoop installed and set up. In
this example we will be using Hadoop single node setup, and that's what we'll do first.
A few basic steps to the setup are:
1.
Download the Hadoop tarball distribution:
https://archive.apache.org/dist/hadoop/core/
hadoop-1.1.1/hadoop-1.1.1-bin.tar.gz
2.
Extract the tarball into a local folder and run the following command:
$HADOOP_HOME/bin/hadoop namenode -format
Search WWH ::




Custom Search