Click here to monitor SSC
  • Av rating:
  • Total votes: 1
  • Total comments: 1
Roger Jennings

Analyze Big Data with Apache Hadoop on Windows Azure Preview Service Update 3

05 September 2012

Hadoop and MapReduce have good prospects for adoption as a standard for big data analysis, especially since its adoption by Microsoft. It is ideal for Cloud usage since one can spin up nodes when required, pay only for storage and compute services whilst they are running.  Roger Jennings descibes how to get it running on Azure.

Big data is receiving more than its share of coverage by industry pundits these days, while startups offering custom Hadoop and related open-source distributions are garnering hundreds of millions of venture capital dollars. The term Hadoop usually refers to the combination of the open-source, Java-based Hadoop Common project and its related MapReduce and Hadoop Distributed File System (HDFS) subprojects managed by the Apache Software Foundation (ASF). Amazon Web Services announced the availability of an Elastic MapReduce beta version for EC2 and S3 on April 2, 2009. Google obtained US Patent 7,650,331 entitled “System and method for efficient large-scale data processing,” which covers MapReduce, on January 19, 2010 and subsequently licensed the patent to ASF.

Microsoft put its oar in the big-data waters when Ted Kumert, Corporate VP of Microsoft’s Business Platform Divison announced a partnership with Hortonworks to deliver Apache Hadoop distributions for Windows Azure and Windows Server at the Professional Association for SQL Server (PASS) Summit 2011 on October 12, 2011. (Hortonworks is a Yahoo! spinoff and one of the “big two” in Hadoop distribution, tools and training; Cloudera is today’s undisputed leader in that market segment.) Despite an estimated 58% compounded annual growth rate (CAGR) for commercial Hadoop services, reaching US$2.2 billion in 2018, Gartner placed MapReduce well into their “Trough of Disillusionment” period in a July 2012 Hype Cycle for Big Data chart (see Figure 1).

 Gartner’s Hype Cycle for Big Data chart

Figure 1. Gartner’s Hype Cycle for Big Data chart

The Hype Cycle for Big Data chart places MapReduce and Alternatives in the Trough of Disillusionment with two to five years to reach the Plateau of Productivity despite rosy estimates for a 58% CAGR and US$2.2 billion of Hadoop service income by 2018. GigaOm’s Sector RoadMap: Hadoop platforms 2012 research report describes a lively Hadoop platform market. I believe Gartner is overly pessimistic about Hadoop’s current and short-term future prospects.

The SQL Server Team released an Apache Hadoop for Windows Azure (AH4WS) CTP to a limited number of prospective customers on December 14, 2011. I signed up shortly after the Web release but wasn’t admitted to the CTP until April 1, 2012; my first blog post about the CTP was Introducing Apache Hadoop Services for Windows Azure of April 2. Apache Hadoop for Windows Azure (AH4WS) Service Update 2 of June 29, 2012 added new features, updated versions (see Table 1) and increased cluster capacity by 2.5 times, which broke the logjam of users waiting to be onboarded to the CTP. Service Update 3 of August 21, 2012 added a REST APIs for Hadoop job submission, progress inquiry and killing jobs, as well as a C# SDK v1.0, PowerShell cmdlets, and direct browser access to a cluster.

Table 1. The components and versions of the SQL Server team’s Apache Hadoop on Windows Azure CTP service updates of June 29, 2012 (SU2) and August 21, 2012 (SU3). Component descriptions are from the Apache Software Foundation, except CMU Pegasus.

 

Component Description SU2 Version SU3 Version
Hadoop Common The common utilities that support other Hadoop subprojects   0.20.203.1 1.0.1
Hadoop MapReduce A software framework for distributed processing of large data sets on compute clusters   0.20.203.1 1.0.1
HDFS Hadoop Distributed File System, the primary storage system used by Hadoop applications   0.20.203.1 1.0.1
Hive A data warehouse infrastructure that provides data summarization and ad hoc querying   0.7.1 0.8.1
Pig A high-level data-flow language and execution framework for parallel computation   0.8.1 0.9.3
Mahout A scalable machine learning and data mining library  0.5 0.5
Sqoop A tool designed for efficiently transferring bulk data between Apache Hadoop and structured datastores, such as relational databases   1.3.1 1.4.2
CMU Pegasus A graph mining package to compute degree distribution of a sample graph*   2 2

 

*Pegasus is an open-source graph mining package developed by people from the School of Computer Science (SCS), Carnegie Mellon University (CMU).

Note: The Yahoo! Apache Hadoop on Azure CTP group provides technical support for AH4WA, not the usual social.msdn.microsoft.com or social.technet.msdn.com forums for Windows Azure.

Apache Hadoop for Windows Azure Basics

Cloud computing is a natural fit for big data analysis with Hadoop MapReduce and its subprojects because users can spin up nodes when required, pay only for storage and compute services while running, and shut the nodes down when the process completes. AH4WA runs MapReduce in Windows Azure’s Java virtual machine (JVM) to provide horizontal scalability and high reliability. MapReduce is a batch programming model with a procedural language for mapping (dividing) input data into multiple sub-problems and distributing the sub-problems to worker nodes, which run in parallel under HDFS on clusters of many computers. For example, according to Hortonworks CEO Eric Baldeschweiler, Yahoo! had in mid-2011 a production Hadoop cluster with 42,000 nodes holding 180 to 200 petabytes of data. Facebook’s Jay Parikh claimed in August 2012 that his company runs the world’s largest Hadoop cluster, which spans more than 100 petabytes of data and analyzes about 105 terabytes every 30 minutes.

The map() function returns a list of key/value pairs. The reduce() function collects the list and aggregates (summarizes) the values in a HDFS text file.  Hadoop excels at processing unstructured text files. For example, following is the Java code for the widely-distributed, canonical WordCount MapReduce sample program, which counts the number of different words in a set of documents (courtesy of Wikipedia):

function map(String name, String document):
   // name: document name
   // document: document contents
   for each word w in document:
     emit (w, 1)

function reduce(String word, Iterator partialCounts):
   // word: a word
   // partialCounts: a list of aggregated partial counts
   sum = 0
   for each pc in partialCounts:
     sum += pc
   emit (word, sum)

AH4WA’s initial release offered users a choice of four no-charge cluster sizes, ranging from small (4 nodes with 2 TB disk space) to extra-large (32 nodes with 16 TB disk space), hosted in Microsoft’s North Central US (Chicago) data center. Cluster lifetime was 48 hours and users could renew their clusters during the last few hours of its life. SU2 provided only a two-node cluster with 1 TB diskspace to accommodate more users. SU3 offers three nodes and 1.5 TB disk space with a five-day, non-renewable lifetime at no charge (see Figure 2). However users can request more cluster nodes and diskspace with an indefinite lifetime by paying standard Windows Azure compute and storage charges.

 

Signing up for a new free Hadoop cluster.

Figure 2. Signing up for a new free Hadoop cluster.

 

You can sign up for a free Hadoop cluster at http://www.hadooponazure.com by specifying a unique DNS prefix name and login username/password combination, and then clicking the Request Cluster button. Click the Downloads tile for links to SU3’s new Hadoop C# SDK and PowerShell cmdlets, as well as the previously available 32/64-bit ODBC drivers and Excel add-in for analyzing Apache Hive data.

AH4WA UD3’s Management Dashboard

After you’ve created your cluster, you can open the landing page of UD3’s new URL-enabled management dashboard by typing https://YourClusterDNSName.cloudapp.net in your browser’s address bar, https://oakleafhoa.cloudapp.net for this example. Ignore the certificate error you receive from AH4WA UD3’s first release by clicking the Continue to This Website button; the team promises to fix this issue shortly. Then, enter the username and password credentials you specified in Figure 2 to launch the modern UI (née Metro) style RESTful dashboard’s landing page (see Figure 3).

 

Click a tile to open a page to manage each feature set of AH4WA, review job history or create a new MapReduce job. SU2 added five new samples to the original four and support for Apache Sqoop.

Figure 3. Click a tile to open a page to manage each feature set of AH4WA, review job history or create a new MapReduce job. SU2 added five new samples to the original four and support for Apache Sqoop.

 

One of the AH4WA team’s goals was to make Hadoop and MapReduce technologies more accessible to developers and users who aren’t data scientists or business intelligence/data warehousing experts. AH4WA’s Interactive Console makes JavaScript a first-class language for running MapReduce jobs. The console also enables writing ad hoc Apache Hive queries in a text box and executing them interactively (see Figure 4). Hive translates familiar SQL-like aggregate queries written in HiveQL to MapReduce instructions and executes them automatically. An ODBC Server and Hive Add-In for Excel combine with Excel PowerPivot to provide do-it-yourself big data analysis for end users. My Using Excel 2010 and the Hive ODBC Driver to Visualize Hive Data Sources in Apache Hadoop on Windows Azure post is a detailed tutorial for this feature.

 

Interactive Hive

Figure 4. Interactive Hive

 

Write a HiveQL statement in Interactive Hive console’s text box and click Evaluate to execute it with MapReduce, if necessary. The HiveQL describe keyword returns a list of column names and data types for a Hive table, the prebuilt hivesampletable for this example.

The most common data sources for MapReduce analysis are structured or unstructured text files. Hive requires structured data with a schema, such as Web-server log files or the U.S. Federal Aviation Administration’s air carrier flight delay data. The Manage Cluster page offers disaster protection with optional periodic data snapshots, and lets you choose data stored in Amazon S3 or Windows Azure blobs, or downloaded from the Windows Azure Marketplace DataMarket instead of on-premises text files (see Figure 5).

 

Configure cloud data from Windows Azure or Amazon Web Services as a MapReduce or Hive data source on the Configure Cluster page.

Figure 5. Configure cloud data from Windows Azure or Amazon Web Services as a MapReduce or Hive data source on the Configure Cluster page. (ASV is an abbreviation for “Azure Storage Vault.”) SU3 didn’t fix the problem with accessing public Windows Azure blobs caused by requiring a Passkey to enable the Save Settings button.

 AH4WA SU3 didn’t add new samples to SU2’s nine, despite a “more coming soon” promise (see Figure 6). My detailed tutorial for running the TeraGen, TeraSort and TeraValidate jobs of the 10 GB GraySort sample is here.

 Figure 6. The Sample Gallery

Figure 6. The Sample Gallery

 This page offers demonstrations of classic MapReduce demo jobs, such as GraySort, Pi Estimator, and Word Count, as well as Mahout, Pegasus, and Sqoop projects. The C# Streaming example shows you how to execute a C# application using the Hadoop streaming interface v1.0.3. (The page’s link was to an earlier 0.20.201.0 version of the documentation at press time.)

SU3’s C# SDK 1.0 for Interacting with AH2WA Clusters Programatically

Brad Sarsfield of the AH2WA team updated on July 16, 2012 a prototype HadoopOnAzureJobClient .NET library for SU2, which used a REST API  “to submit jobs against the Hadoop on Azure free preview” for download as a hadooponazure-rest-api.zip file or from GitHub as https://github.com/bradsa/hadooponazure-rest-api. SU3 supercedes this library with Microsoft.Isotope.ClusterService and Microsoft.Isotope.Sdk namespaces contained in the IsotopeCsharpSdk.zip archive that you can download from the link on the Downloads page or here. Expand the files, which depend on .NET Framework 4, and add references to the DLLs in a new C# project.

The SDK’s Readme.txt file provides terse documentation to:

1. Get status of a running job:

var input = new HiveJobInput { Execute = "SELECT * from 
hivesampletable limit 10;" };
  JobSubmitResult result = context.SubmitHiveJob(input);
  JobStatus status = context.GetJobStatus<HiveJobStatus>(result.Id);

2. Kill a running job:

context.KillJob(/*Id from the JobSubmitResult class*/);

3. Get the Id’s of all running jobs on the cluster:

List<string> jobs = context.GetAllPendingJobs();

4. Get history of all jobs that have completed:

<JobStatus> jobHistoryItems =
context.GetIsotopeJobSubmissionHistoryList(numberOfItems: 1);

5. Get job history for a specific job:

JobHistoryItem jobHistory =  
        context.GetIsotopeJobSubmissionHistory(/*Id
from the JobSubmitResult or JobId from JobHistoryItem class*/);

6. Upload a file to HDFS (job related assets):

bool result = context.UploadFileToHdfs("Isotope.Sdk.dll",
"hdfs:///user/Isotope.Sdk.dll");

7. List files in HDFS:

FileListOutput files = context.GetFileListFromHdfs("hdfs:///user/");

8. Get all MapReduce jobs that have completed:

<JobHistoryItem> jobHistoryItems =
context.GetJobHistoryList(numberOfItems: 10,
includeJobDetails: false);

9. Get the details of a single mapreduce job:

JobHistoryItem jobHistory = context.GetJobHistory(/*
hadoop mapreduce jobId */);

The library also includes six instructions to Get, Set and Delete credentials for ASV and S3 data sources.

With its third Service Update, AH4WS has gained the maturity needed to complete with other cloud-based Hadoop implementations, such as Amazon’s Elastic MapReduce. The CTP now delivers bonuses in the form of an SDK for .NET developers and an intuitive, a browser-based Web UI for non-programmers, and an Excel Hive add-in for do-it-yourself business analysts.

 

Roger Jennings

Author profile:

Roger Jennings is a data-oriented .NET developer and writer, a Windows Azure MVP, a member of Azure Insiders, the principal consultant of OakLeaf Systems, and curator of the OakLeaf Systems blog. He's also the author of 30+ books on the Windows Azure Platform, Microsoft operating systems, databases, .NET data access, Web services and InfoPath 2003. Forbes Magazine ranked him seventh in a "Who Are The Top 20 Influencers in Big Data?" article of February 3, 2012.

Search for other articles by Roger Jennings

Rate this article:   Avg rating: from a total of 1 votes.


Poor

OK

Good

Great

Must read
Have Your Say
Do you have an opinion on this article? Then add your comment below:
You must be logged in to post to this forum

Click here to log in.


Subject:
Posted by: Pankaj Bhaskar (not signed in)
Posted on: Monday, December 03, 2012 at 8:02 AM
Message: Hi Roger, please help with the following posts . we tried everything to get data from HIVE but failed. http://social.msdn.microsoft.com/Forums/en-US/hdinsight/thread/f13a6044-6759-4c6e-8ef6-ddcded2b9434 http://social.msdn.microsoft.com/Forums/en-US/hdinsight/thread/a99e8866-6954-4b1b-af3a-af022319f845

 

Top Rated

Data Science Laboratory System – Object-Oriented Databases
 Object-Oriented Databases (OOD) avoid the object-relational impedence mismatch altogether by tightly... Read more...

Tales from a Cloud Software Firm
 Following on from a discussion about how people are using the cloud, the Simple-Talk Editorial Team sat... Read more...

Data Science Laboratory System – Document Store Databases
 A Document Store Database (DSD) is similar to a Relational Database Management system with the... Read more...

Data Science Laboratory System - Instrumentation
 It is sensible to check the performance of different solutions to data analysis in 'lab' conditions.... Read more...

Testing the StreamInsight Service for Windows Azure
 Getting 'up to speed' with StreamInsight is easier if you take the time to run it and test it out.... Read more...

Most Viewed

Windows Azure Virtual Machine: A look at Windows Azure IaaS Offerings (Part 2)
 We continue our introduction of the Azure IaaS by discussing how images and disks are used in the Azure... Read more...

PHPFog and Pagoda Box: A Look at PHP Platforms
 Cloud platforms such as Heroku, AppEngine, PHPFog and Pagoda Box are ideal for companies who just want... Read more...

An Introduction to Windows Azure BLOB Storage
 Azure BLOB storage is persistent Cloud data storage that serves a variety of purposes. Mike Wood shows... Read more...

Managing session state in Windows Azure: What are the options?
 Because you can't maintain session state for ASP.NET applications in Azure using the default in-process... Read more...

Creating a custom Login page for federated authentication with Windows Azure ACS
 Windows Azure Acess Control Service (ACS) provides a way of authenticating users who need to access web... Read more...

Why Join

Over 400,000 Microsoft professionals subscribe to the Simple-Talk technical journal. Join today, it's fast, simple, free and secure.