Search This Blog

Saturday, 11 February 2017

practical key value pairs

Analysis of Mapreduce program without Mapper and without Reducer and study what exactly happens:

primary input data i send to HDFS:

[training@localhost ~]$ hadoop fs -cat qaz/sample.txt
aaa bb
aa
aa
bbb
cc
dd dd
dd ff
cc
dd
ff gg
gg
dd

I execute My MAPR program by eliminating Mapper and Reducer by making 

mapper reducer as Identity mapper and Identity reducer i got following Output

[training@localhost ~]$ hadoop fs -cat qaz/mapop/part-00000  [ remove mapper and reducer]
0       aaa bb
7       aa
10      aa
13      bbb
17      cc
20      dd dd
26      dd ff
32      cc
35      dd
38      ff gg
44      gg
47      dd


if u observed the above  output the data in Hadoop Cluster divided in to  Blocks by getting Record information in Byteoffset address key and Value as entire line




[training@localhost ~]$ hadoop fs -cat qaz/redop/part-00000
aa      1
aa      1
aaa     1
bb      1
bbb     1
cc      1
cc      1
dd      1
dd      1
dd      1
dd      1
dd      1
ff      1
ff      1
gg      1
gg      1

In above output eliminated reducer only mapper is there, it generated input data blocks executed mapping program by DataNode daemons and produce final mapping sorting shuffling output

in key value pair to reducer program

[training@localhost ~]$ hadoop fs -cat qaz/op1/part-00000
aa      2
aaa     1
bb      1
bbb     1
cc      2
dd      5
ff      2
gg      2


finally the reducer program generates group similar key values and reduces the final output result

Thursday, 9 February 2017

Key value pairs
























MapR will play key role in Hadoop

The input data is placed in HDFS


once job is submiited to the Hadoop Cluster

The NN dispatch Blocks To Dn's and Start Task of Parallel massive Program Execution



In each phase


input    <k1,v1>  pair

Mapper <k1,12>----><k2,v2>


Reducer <k2,v2>---<k3,v3>



The Input Key,Value Format will play key role the next session part with program demo.....







Sunday, 5 February 2017

map reduce program execution in cloudera



First boot vmware1.6.vmo iso image in to vmware work station  , then it opens cloudera centos image  os as shown below







Open eclipse ide and go for projects build projects , u can find out  in project explorer


Create a class file for wordcount:  driver code,mappercode,reducer code as shown below




AFTER EXPORT YOUR JAR FILE  TO HDFS
PROJECTFOLDER-àEXPORT-->JARFILE-àNAME OF THE JAR FILE





Driver code:
WordCount.java

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;

import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

public class WordCount extends Configured implements Tool {

  @Override
  public int run(String[] args) throws Exception {

    if (args.length != 2) {
      System.out.printf(
          "Usage: %s [generic options] <input dir> <output dir>\n", getClass()
              .getSimpleName());
      ToolRunner.printGenericCommandUsage(System.out);
      return -1;
    }

    JobConf conf = new JobConf(getConf(), WordCount.class);
    conf.setJobName(this.getClass().getName());

    FileInputFormat.setInputPaths(conf, new Path(args[0]));
    FileOutputFormat.setOutputPath(conf, new Path(args[1]));

    conf.setMapperClass(WordMapper.class);
    conf.setReducerClass(SumReducer.class);

    conf.setMapOutputKeyClass(Text.class);
    conf.setMapOutputValueClass(IntWritable.class);

    conf.setOutputKeyClass(Text.class);
    conf.setOutputValueClass(IntWritable.class);

    JobClient.runJob(conf);
    return 0;
  }

  public static void main(String[] args) throws Exception {
    int exitCode = ToolRunner.run(new WordCount(), args);
    System.exit(exitCode);
  }
}


WordMapper.java

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.Mapper;

import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;

public class WordMapper extends MapReduceBase implements
    Mapper<LongWritable, Text, Text, IntWritable> {

  @Override
  public void map(LongWritable key, Text value,
      OutputCollector<Text, IntWritable> output, Reporter reporter)
      throws IOException {

    String s = value.toString();
    for (String word : s.split(" ")) {
      if (word.length() > 0) {
        output.collect(new Text(word), new IntWritable(1));
      }
    }
  }
}

// hi this is is arshia

// hi {1} this {1} is {1} is {1} arshia{1}











SumReducer.java

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.Reducer;
import org.apache.hadoop.mapred.Reporter;

public class SumReducer extends MapReduceBase implements
    Reducer<Text, IntWritable, Text, IntWritable> {

  @Override
  public void reduce(Text key, Iterator<IntWritable> values,
      OutputCollector<Text, IntWritable> output, Reporter reporter)
      throws IOException {

    int wordCount = 0;
    while (values.hasNext()) {
      IntWritable value = values.next();
      wordCount += value.get();
    }
    output.collect(key, new IntWritable(wordCount));
  }
}
// hi {1} is {1} is {1} ==> hi {1} is {1+1+1+1}
//hi {1}, is {2}












After add the required jar files 
Src->Build-pathàconfigure Buildpath-àAdd External Jar files

The required jar files that will support and  mapper are:






Commons-cli-1.2.jar   /hadoop/lib
Commons-codec-1.4.j1r    /hadoop/lib
Commons-daemon-1.0.1.jar    /hadoop/lib
Commons-el-1.0.jar            /hadoop/lib
Commons-httpclient-3.1.jar    /hadoop/lib
Commons-logging-1.0.4.jar   /hadoop/lib
Commons-logging-api-1.0.4.jar  /hadoop/lib
Commons-net-1.4.1.jar   /hadoop/lib
Hadoop-0.20.2-cdh3u2-core.jar   /hadoop
Hadoop-core.jar          /hadoop
Jackson-core-asl-1.5.2 .jar           /hadoop/lib
Jackson-mapper-asl-1.5.2.jar       /hadoop/lib
Log4j-1-2-15.jar      /hadoop/lib


Add all these 16 jar files for your build path then u r program EXECUTES AS FOLLOWS
  






MAKE A INPUT DIRECTORY FOR YOUR PROGRAM

[training@localhost ~]$ hadoop fs -mkdir wcs
[training@localhost ~]$ cat > input.txt
hi
i
f
dd
dd
f
[training@localhost ~]$ hadoop fs -put input.txt wcs
[training@localhost ~]$ hadoop fs -mkdir wcs/ouput
[training@localhost ~]$ hadoop jar wc.jar WordCount wcs/input.txt wcs/output
16/09/25 08:38:49 WARN snappy.LoadSnappy: Snappy native library is available
16/09/25 08:38:49 INFO util.NativeCodeLoader: Loaded the native-hadoop library
16/09/25 08:38:49 INFO snappy.LoadSnappy: Snappy native library loaded
16/09/25 08:38:49 INFO mapred.FileInputFormat: Total input paths to process : 1
16/09/25 08:38:50 INFO mapred.JobClient: Running job: job_201609250806_0001
16/09/25 08:38:51 INFO mapred.JobClient:  map 0% reduce 0%
16/09/25 08:39:00 INFO mapred.JobClient:  map 66% reduce 0%
16/09/25 08:39:04 INFO mapred.JobClient:  map 100% reduce 0%
16/09/25 08:39:13 INFO mapred.JobClient:  map 100% reduce 100%
16/09/25 08:39:14 INFO mapred.JobClient: Job complete: job_201609250806_0001
16/09/25 08:39:14 INFO mapred.JobClient: Counters: 23
16/09/25 08:39:14 INFO mapred.JobClient:   Job Counters
16/09/25 08:39:14 INFO mapred.JobClient:     Launched reduce tasks=1
16/09/25 08:39:14 INFO mapred.JobClient:     SLOTS_MILLIS_MAPS=18336
16/09/25 08:39:14 INFO mapred.JobClient:     Total time spent by all reduces waiting after reserving slots (ms)=0
16/09/25 08:39:14 INFO mapred.JobClient:     Total time spent by all maps waiting after reserving slots (ms)=0
16/09/25 08:39:14 INFO mapred.JobClient:     Launched map tasks=3
16/09/25 08:39:14 INFO mapred.JobClient:     Data-local map tasks=3
16/09/25 08:39:14 INFO mapred.JobClient:     SLOTS_MILLIS_REDUCES=13372
16/09/25 08:39:14 INFO mapred.JobClient:   FileSystemCounters
16/09/25 08:39:14 INFO mapred.JobClient:     FILE_BYTES_READ=57
16/09/25 08:39:14 INFO mapred.JobClient:     HDFS_BYTES_READ=317
16/09/25 08:39:14 INFO mapred.JobClient:     FILE_BYTES_WRITTEN=219760
16/09/25 08:39:14 INFO mapred.JobClient:     HDFS_BYTES_WRITTEN=18
16/09/25 08:39:14 INFO mapred.JobClient:   Map-Reduce Framework
16/09/25 08:39:14 INFO mapred.JobClient:     Reduce input groups=4
16/09/25 08:39:14 INFO mapred.JobClient:     Combine output records=0
16/09/25 08:39:14 INFO mapred.JobClient:     Map input records=6
16/09/25 08:39:14 INFO mapred.JobClient:     Reduce shuffle bytes=69
16/09/25 08:39:14 INFO mapred.JobClient:     Reduce output records=4
16/09/25 08:39:14 INFO mapred.JobClient:     Spilled Records=12
16/09/25 08:39:14 INFO mapred.JobClient:     Map output bytes=39
16/09/25 08:39:14 INFO mapred.JobClient:     Map input bytes=15
16/09/25 08:39:14 INFO mapred.JobClient:     Combine input records=0
16/09/25 08:39:14 INFO mapred.JobClient:     Map output records=6
16/09/25 08:39:14 INFO mapred.JobClient:     SPLIT_RAW_BYTES=291
16/09/25 08:39:14 INFO mapred.JobClient:     Reduce input records=6
[training@localhost ~]$
[training@localhost ~]$ hadoop fs -ls
Found 8 items
drwxr-xr-x   - training supergroup          0 2016-09-23 10:48 /user/training/INPUT
-rw-r--r--   1 training supergroup         49 2016-05-22 16:50 /user/training/hadoop1
drwxr-xr-x   - training supergroup          0 2016-05-22 17:02 /user/training/hadoop1_out
drwxr-xr-x   - training supergroup          0 2016-05-12 17:01 /user/training/hadoop_China
drwxr-xr-x   - training supergroup          0 2016-09-23 10:48 /user/training/hdir
drwxr-xr-x   - training supergroup          0 2016-09-22 11:28 /user/training/input
drwxr-xr-x   - training supergroup          0 2016-09-22 11:28 /user/training/outpt
drwxr-xr-x   - training supergroup          0 2016-09-25 08:38 /user/training/wcs
[training@localhost ~]$ hadoop fs -ls /user/training/wcs
Found 3 items
-rw-r--r--   1 training supergroup         15 2016-09-25 08:36 /user/training/wcs/input.txt
drwxr-xr-x   - training supergroup          0 2016-09-25 08:37 /user/training/wcs/ouput
drwxr-xr-x   - training supergroup          0 2016-09-25 08:39 /user/training/wcs/output
[training@localhost ~]$ hadoop fs -cat /user/training/wcs/input.txt
hi
i
f
dd
dd
f
[training@localhost ~]$ hadoop fs -ls /user/training/wcs/output
Found 3 items
-rw-r--r--   1 training supergroup          0 2016-09-25 08:39 /user/training/wcs/output/_SUCCESS
drwxr-xr-x   - training supergroup          0 2016-09-25 08:38 /user/training/wcs/output/_logs
-rw-r--r--   1 training supergroup         18 2016-09-25 08:39 /user/training/wcs/output/part-00000
[training@localhost ~]$ hadoop fs -cat /user/training/wcs/output/_SUCCESS
[training@localhost ~]$ hadoop fs -cat /user/training/wcs/output/part-00000
dd      2
f       2
hi      1
i       1
[training@localhost ~]$
[training@localhost ~]$






Brief Introduction How Hadoop  MapR Works:


Hadoop MAPR program used to reduce the data u submitted to HDFS from local File System

first u create a File in  Local File System:
step1:
 Create local file

cat > myfile.txt

this is my file
this is first file
my file
ctrl+d


it will creates a myfile.txt in your linux  local file system

step2:

loaded in to HDFS

create a directory in HDFS

$ hadoop fs -mkdir mydir

t
place your local file in to this directory



$ hadoop fs -put myfile.txt mydir


Step3:

execute MapR program u done in ecllipse


$hadoop jar wordcount.jar  WordCount  mydir/myfile.txt  mydir/out


once the above command executed MapR program executed and generate output maintain in OUT directory



$hadoop fs -cat /user/training/mydir/out/part-00000


this  2
is     2
my 2
file 3



The Anlytic MapR program u should write in JAVA

Friday, 3 February 2017

File Formats part-1

Input File formats In HDFS


In general the input file format will play key role Hadoop MapR Programming

because of the output is generated in three stages


primary data---> IN HDFS---->  Mapper______> Map output-------------> Reducer Input/Output



HDFS data Represented  in Text,Sequential and Binary Format


By default It Will Represent Text Input Format

if u have submitted the input data to the HDFS

it will organise the data like KEY , VALUE pairs


key is the BYTEOFFSET    ie   address value of the Line


Value is the Individual String of line in your file system 

Wednesday, 1 February 2017

Hadoop releases

What Is Apache Hadoop?

The Apache™ Hadoop® project develops open-source software for reliable, scalable, distributed computing.
The Apache Hadoop software library is a framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models. It is designed to scale up from single servers to thousands of machines, each offering local computation and storage. Rather than rely on hardware to deliver high-availability, the library itself is designed to detect and handle failures at the application layer, so delivering a highly-available service on top of a cluster of computers, each of which may be prone to failures.
The project includes these modules:
  • Hadoop Common: The common utilities that support the other Hadoop modules.
  • Hadoop Distributed File System (HDFS™): A distributed file system that provides high-throughput access to application data.
  • Hadoop YARN: A framework for job scheduling and cluster resource management.
  • Hadoop MapReduce: A YARN-based system for parallel processing of large data sets.
Other Hadoop-related projects at Apache include:
  • Ambari™: A web-based tool for provisioning, managing, and monitoring Apache Hadoop clusters which includes support for Hadoop HDFS, Hadoop MapReduce, Hive, HCatalog, HBase, ZooKeeper, Oozie, Pig and Sqoop. Ambari also provides a dashboard for viewing cluster health such as heatmaps and ability to view MapReduce, Pig and Hive applications visually alongwith features to diagnose their performance characteristics in a user-friendly manner.
  • Avro™: A data serialization system.
  • Cassandra™: A scalable multi-master database with no single points of failure.
  • Chukwa™: A data collection system for managing large distributed systems.
  • HBase™: A scalable, distributed database that supports structured data storage for large tables.
  • Hive™: A data warehouse infrastructure that provides data summarization and ad hoc querying.
  • Mahout™: A Scalable machine learning and data mining library.
  • Pig™: A high-level data-flow language and execution framework for parallel computation.
  • Spark™: A fast and general compute engine for Hadoop data. Spark provides a simple and expressive programming model that supports a wide range of applications, including ETL, machine learning, stream processing, and graph computation.
  • Tez™: A generalized data-flow programming framework, built on Hadoop YARN, which provides a powerful and flexible engine to execute an arbitrary DAG of tasks to process data for both batch and interactive use-cases. Tez is being adopted by Hive™, Pig™ and other frameworks in the Hadoop ecosystem, and also by other commercial software (e.g. ETL tools), to replace Hadoop™ MapReduce as the underlying execution engine.
  • ZooKeeper™: A high-performance coordination service for distributed applications.

Getting Started

To get started, begin here:
  1. Learn about Hadoop by reading the documentation.
  2. Download Hadoop from the release page.
  3. Discuss Hadoop on the mailing list.

Download Hadoop

Please head to the releases page to download a release of Apache Hadoop.

Who Uses Hadoop?

A wide variety of companies and organizations use Hadoop for both research and production. Users are encouraged to add themselves to the Hadoop PoweredBy wiki page.

News



25 January, 2017: Release 3.0.0-alpha2 available

This is the second alpha in a series of planned alphas and betas leading up to a 3.0.0 GA release. The intention is to "release early, release often" to quickly iterate on feedback collected from downstream users.
Please note that alpha releases come with no guarantees of quality or API stability, and are not intended for production use.
Users are encouraged to read the overview of major changes coming in 3.0.0. The alpha2 release notes and changelog detail 857 fixes, improvements, and new features since the previous 3.0.0-alpha2 release.

08 October, 2016: Release 2.6.5 available

A point release for the 2.6 line.
Please see the Hadoop 2.6.5 Release Notes for the list of 79 critical bug fixes and since the previous release 2.6.4.

03 September, 2016: Release 3.0.0-alpha1 available

This is the first alpha in a series of planned alphas and betas leading up to a 3.0.0 GA release. The intention is to "release early, release often" to quickly iterate on feedback collected from downstream users.
Please note that alpha releases come with no guarantees of quality or API stability, and are not intended for production use.
Users are encouraged to read the overview of major changes coming in 3.0.0. The full set of release notes and changelog detail all the changes since the previous minor release 2.7.0.

25 August, 2016: Release 2.7.3 available

A point release for the 2.7 line.
Please see the Hadoop 2.7.3 Release Notes for the list of 221 bug fixes and patches since the previous release 2.7.2.

11 February, 2016: Release 2.6.4 available

A point release for the 2.6 line.
Please see the Hadoop 2.6.4 Release Notes for the list of 46 critical bug fixes and since the previous release 2.6.3.

25 January, 2016: Release 2.7.2 (stable) available

A point release for the 2.7 line.
Please see the Hadoop 2.7.2 Release Notes for the list of 155 bug fixes and patches since the previous release 2.7.1.

17 December, 2015: Release 2.6.3 available

A point release for the 2.6 line.
Please see the Hadoop 2.6.3 Release Notes for the list of 35 critical bug fixes and since the previous release 2.6.2.

28 October, 2015: Release 2.6.2 available

A point release for the 2.6 line.
Please see the Hadoop 2.6.2 Release Notes for the list of 15 critical bug fixes and since the previous release 2.6.1.

23 September, 2015: Release 2.6.1 available

A point release for the 2.6 line.
Please see the Hadoop 2.6.1 Release Notes for the list of 158 critical bug fixes and since the previous release 2.6.0.

06 July, 2015: Release 2.7.1 (stable) available

A point release for the 2.7 line. This release is now considered stable.
Please see the Hadoop 2.7.1 Release Notes for the list of 131 bug fixes and patches since the previous release 2.7.0. Please look at the 2.7.0 section below for the list of enhancements enabled by this first stable release of 2.7.x.

21 April 2015: Release 2.7.0 available

Apache Hadoop 2.7.0 contains a number of significant enhancements. A few of them are noted below.
  • IMPORTANT notes
    • This release drops support for JDK6 runtime and works with JDK 7+ only.
    • This release is not yet ready for production use. Critical issues are being ironed out via testing and downstream adoption. Production users should wait for a 2.7.1/2.7.2 release.
  • Hadoop Common
    • Support Windows Azure Storage - Blob as a file system in Hadoop.
  • Hadoop HDFS
    • Support for file truncate
    • Support for quotas per storage type
    • Support for files with variable-length blocks
  • Hadoop YARN
    • Make YARN authorization pluggable
    • Automatic shared, global caching of YARN localized resources (beta)
  • Hadoop MapReduce
    • Ability to limit running Map/Reduce tasks of a job
    • Speed up FileOutputCommitter for very large jobs with many output files.
Full information about this milestone release is available at Hadoop Releases.

18 November, 2014: release 2.6.0 available

Apache Hadoop 2.6.0 contains a number of significant enhancements such as:
  • Hadoop Common
    • Key management server (beta)
    • Credential provider (beta)
  • Hadoop HDFS
    • Heterogeneous Storage Tiers - Phase 2
      • Application APIs for heterogeneous storage
      • SSD storage tier
      • Memory as a storage tier (beta)
    • Support for Archival Storage
    • Transparent data at rest encryption (beta)
    • Operating secure DataNode without requiring root access
    • Hot swap drive: support add/remove data node volumes without restarting data node (beta)
    • AES support for faster wire encryption
  • Hadoop YARN
    • Support for long running services in YARN
      • Service Registry for applications
    • Support for rolling upgrades
      • Work-preserving restarts of ResourceManager
      • Container-preserving restart of NodeManager
    • Support node labels during scheduling
    • Support for time-based resource reservations in Capacity Scheduler (beta)
    • Global, shared cache for application artifacts (beta)
    • Support running of applications natively in Docker containers (alpha)
Full information about this milestone release is available at Hadoop Releases.

19 November, 2014: release 2.5.2 available

Full information about this milestone release is available at Hadoop Releases.

12 September, 2014: release 2.5.1 available

Full information about this milestone release is available at Hadoop Releases.

11 August, 2014: release 2.5.0 available

Full information about this milestone release is available at Hadoop Releases.

30 June, 2014: release 2.4.1 available

Full information about this milestone release is available at Hadoop Releases.

27 June, 2014: release 0.23.11 available

Full information about this milestone release is available at Hadoop Releases.

07 April, 2014: release 2.4.0 available

Full information about this milestone release is available at Hadoop Releases.

20 February, 2014: release 2.3.0 available

Full information about this milestone release is available at Hadoop Releases.

11 December, 2013: release 0.23.10 available

Full information about this milestone release is available at Hadoop Releases.

15 October, 2013: release 2.2.0 available

Apache Hadoop 2.x reaches GA milestone! Full information about this milestone release is available at Hadoop Releases.

25 August, 2013: release 2.1.0-beta available

Apache Hadoop 2.x reaches beta milestone! Full information about this milestone release is available at Hadoop Releases.

27 December, 2011: release 1.0.0 available

Hadoop reaches 1.0.0! Full information about this milestone release is available at Hadoop Releases.

March 2011 - Apache Hadoop takes top prize at Media Guardian Innovation Awards

Described by the judging panel as a "Swiss army knife of the 21st century", Apache Hadoop picked up the innovator of the year award for having the potential to change the face of media innovations.

January 2011 - ZooKeeper Graduates

Hadoop's ZooKeeper subproject has graduated to become a top-level Apache project.
Apache ZooKeeper can now be found at http://zookeeper.apache.org/

September 2010 - Hive and Pig Graduate

Hadoop's Hive and Pig subprojects have graduated to become top-level Apache projects.
Apache Hive can now be found at http://hive.apache.org/
Pig can now be found at http://pig.apache.org/

May 2010 - Avro and HBase Graduate

Hadoop's Avro and HBase subprojects have graduated to become top-level Apache projects.
Apache Avro can now be found at http://avro.apache.org/
Apache HBase can now be found at http://hbase.apache.org/

July 2009 - New Hadoop Subprojects

Hadoop is getting bigger!
  • Hadoop Core is renamed Hadoop Common.
  • MapReduce and the Hadoop Distributed File System (HDFS) are now separate subprojects.
  • Avro and Chukwa are new Hadoop subprojects.
See the summary descriptions for all subprojects above. Visit the individual sites for more detailed information.

March 2009 - ApacheCon EU

In case you missed it.... ApacheCon Europe 2009

November 2008 - ApacheCon US

In case you missed it.... ApacheCon US 2008

July 2008 - Hadoop Wins Terabyte Sort Benchma

Hadoop Analytics

AI & DS HUE EXPERIMENT

   STEP 1 — Create Sample Dataset (On Linux) Create emp1.csv: vi emp1.csv Paste: employee_id,name,department,salary 1,John Doe,Engineer...