Skip to main content

Posts

Showing posts from July, 2012

Getting Data from RestFB and Creating Sequence File > Hadoop

Here is a quick code to get data from Facebook using RestFB API and create Sequence file and dump you data into Hadoop Cluster. Requirement: Hadoop 1.0.3 Installed as Stand Alone or Multinode.  Eclipse IDE for development  Hadoop and Apache commons jars.  RestFB APIs  Steps to Create Eclipse Project. New Java Project.  Add the jar to the project. (Apache Commons and hadoop-core.1.0.3.jar) and add RestFB jar.  You will find all (commons and hadoop) jars under hadoop directory.  Sequence File Content Format. Key – <facebook_id, facebook_name, timestamp>  Value – <batch_me, batch_me_friends, batch_me_likes> Add the below code to get DATA from Facebook and generate Sequence File. Before you start you need to updated the AccessToken in the code with yours Access Token from Facebook. Take look here before you proceed.

Getting Batch Data from Facebook using restFB APIs

Here is quick sample code to get data from Facebook Batch API. Download the jar from here - http://code.google.com/p/restfb/downloads/detail?name=restfb-1.6.9.zip And put it in your library path and execute the below code. Go to this link and login to facebook to get your access token : https://developers.facebook.com/tools/explorer Change the code to pass your “AccessToken” directly to “ DefaultFacebookClient facebookClient = new DefaultFacebookClient("<<<ACCESSTOKEN HERE>>>"); “   import static java.lang.String.format; import static java.lang.System.currentTimeMillis; import static java.lang.System.out; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import com.restfb.Connection; import com.restfb.DefaultFacebookClient; import com.restfb.DefaultJsonMapper; import com.restfb.Facebook; import com.restfb.FacebookClient; import com.restfb.JsonMapper; im

Installing Hadoop 1.0.3 on Ubuntu Single Node Cluster using shell script

I was working on setting up Hadoop on Ubuntu as a Single node cluster. I came across a very nice blog about it here . (Must read to setup your single node cluster). While I was at it, I was creating / Installing Hadoop multiple time in different system, then I though to create a script of my own, based on the blog above. Here is the link to my script which is on GITHUB anyone interested can check-out and enhance the script. https://github.com/zubayr/hadoopscript/blob/master/initScriptHadoop.sh README : https://github.com/zubayr/hadoopscript/blob/master/README.txt Requirement. 1. Hadoop 1.0.3 2. Ubuntu 10.04  or above (Tested on 11.04, 11.10 and 12.04 32bit platform) Here is the details on how to install Hadoop using the script Please Readme - hadoop script to setup Single Node Cluster - For Hadoop 1.0.3 Only. - Tested on Ubuntu 11.10, 12.04 - Fresh Install. - Scripts assumes nothing is installed for Hadoop and installs Required Components for Hadoop to run. - This Script was c