Skip to main content

Building Hadoop on Windows

This post will describe how to build Apache Hadoop (https://hadoop.apache.org/) on a Windows machine. Sometimes you're required to develop or test on Windows machines and in those cases you will need to build Hadoop from scratch because the available pre-built binaries for this OS family don't work fine.
The process described in this post has been tested on Windows Vista and Windows Server 2008 64-bit.
I started from the current stable version (2.7.1) of the Hadoop source code.

Steps:
 - Download a JDK 7 (IBM and Oracle work both).
 - Set the JAVA_HOME variable.
 - Download the Windows SDK 7.1 from one of the following links:
    http://www.microsoft.com/en-in/download/details.aspx?id=8442    (DVD ISO)
    or
    http://www.microsoft.com/en-us/download/confirmation.aspx?id=8279    (Web installer)
    and install it. This SDK comes with the .NET framework 4: it is mandatory to use this release in order to successfully complete the Hadoop building process.
 - Locate the MSBuild.exe (What is MSBuild.exe) and add its location to your system PATH.
 - Download and install CygWin (https://cygwin.com/setup-x86_64.exe)
   During the installation process make sure to select the openssh package and its associated prerequisites from the Select packages tab.
 - Install Maven 3.x (I have used the release 3.1.1, but any 3.x should work fine).
 - Set the M2_HOME variable.
 - Set the Platform variable to x64.
 - Install the Protocol Buffer (Official website), release 2.5.0. At present time the latest stable version is the 2.6.1, but Hadoop 2.7.1 requires the 2.5.0, downloadable from https://github.com/google/protobuf/releases/tag/v2.5.0    It doesn't build using later versions.
 - Set up the PATH variable including the Maven bin folder, the Cygwin bin and usr\sbin folders and the Protocol Buffer root folder.
 - Install CMake (http://www.cmake.org/download/) and include its bin folder to the PATH variable.
 - Download the Hadoop core source code archive from http://www.apache.org/dist/hadoop/core/hadoop-2.7.1/
    and extract its content in any folder you like.
- Build the source code:
    - Select Start —> All Programs —> Microsoft Windows SDK v7.1 and open the Windows SDK 7 command prompt as administrator. Change the working directory to the one where you have extracted the Hadoop source code. Then run the following Maven command:
        mvn package -Pdist,native-win -DskipTests -Dtar
In order to successfully build Hadoop you have to follow all of the steps above and use the exact same releases for the required tools.
This is the summary you will receive when everything has been built successfully:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Hadoop Main ................................. SUCCESS [  3.978 s]
[INFO] Apache Hadoop Project POM .......................... SUCCESS [  1.919 s]
[INFO] Apache Hadoop Annotations .......................... SUCCESS [  4.368 s]
[INFO] Apache Hadoop Assemblies ........................... SUCCESS [  0.265 s]
[INFO] Apache Hadoop Project Dist POM ..................... SUCCESS [  2.918 s]
[INFO] Apache Hadoop Maven Plugins ........................ SUCCESS [  4.290 s]
[INFO] Apache Hadoop MiniKDC .............................. SUCCESS [  3.728 s]
[INFO] Apache Hadoop Auth ................................. SUCCESS [  8.409 s]
[INFO] Apache Hadoop Auth Examples ........................ SUCCESS [  4.851 s]
[INFO] Apache Hadoop Common ............................... SUCCESS [03:09 min]
[INFO] Apache Hadoop NFS .................................. SUCCESS [ 10.795 s]
[INFO] Apache Hadoop KMS .................................. SUCCESS [ 23.120 s]
[INFO] Apache Hadoop Common Project ....................... SUCCESS [  0.078 s]
[INFO] Apache Hadoop HDFS ................................. SUCCESS [03:51 min]
[INFO] Apache Hadoop HttpFS ............................... SUCCESS [ 27.940 s]
[INFO] Apache Hadoop HDFS BookKeeper Journal .............. SUCCESS [  8.440 s]
[INFO] Apache Hadoop HDFS-NFS ............................. SUCCESS [  5.928 s]
[INFO] Apache Hadoop HDFS Project ......................... SUCCESS [  0.062 s]
[INFO] hadoop-yarn ........................................ SUCCESS [  0.063 s]
[INFO] hadoop-yarn-api .................................... SUCCESS [02:27 min]
[INFO] hadoop-yarn-common ................................. SUCCESS [ 49.234 s]
[INFO] hadoop-yarn-server ................................. SUCCESS [  0.063 s]
[INFO] hadoop-yarn-server-common .......................... SUCCESS [ 18.237 s]
[INFO] hadoop-yarn-server-nodemanager ..................... SUCCESS [ 22.698 s]
[INFO] hadoop-yarn-server-web-proxy ....................... SUCCESS [  4.851 s]
[INFO] hadoop-yarn-server-applicationhistoryservice ....... SUCCESS [ 12.434 s]
[INFO] hadoop-yarn-server-resourcemanager ................. SUCCESS [ 30.717 s]
[INFO] hadoop-yarn-server-tests ........................... SUCCESS [  7.862 s]
[INFO] hadoop-yarn-client ................................. SUCCESS [ 10.827 s]
[INFO] hadoop-yarn-server-sharedcachemanager .............. SUCCESS [  4.477 s]
[INFO] hadoop-yarn-applications ........................... SUCCESS [  0.063 s]
[INFO] hadoop-yarn-applications-distributedshell .......... SUCCESS [  3.572 s]
[INFO] hadoop-yarn-applications-unmanaged-am-launcher ..... SUCCESS [  2.730 s]
[INFO] hadoop-yarn-site ................................... SUCCESS [  0.063 s]
[INFO] hadoop-yarn-registry ............................... SUCCESS [  8.502 s]
[INFO] hadoop-yarn-project ................................ SUCCESS [  8.003 s]
[INFO] hadoop-mapreduce-client ............................ SUCCESS [  0.125 s]
[INFO] hadoop-mapreduce-client-core ....................... SUCCESS [ 37.035 s]
[INFO] hadoop-mapreduce-client-common ..................... SUCCESS [ 30.374 s]
[INFO] hadoop-mapreduce-client-shuffle .................... SUCCESS [  7.785 s]
[INFO] hadoop-mapreduce-client-app ........................ SUCCESS [ 16.395 s]
[INFO] hadoop-mapreduce-client-hs ......................... SUCCESS [ 10.640 s]
[INFO] hadoop-mapreduce-client-jobclient .................. SUCCESS [ 17.223 s]
[INFO] hadoop-mapreduce-client-hs-plugins ................. SUCCESS [  4.024 s]
[INFO] Apache Hadoop MapReduce Examples ................... SUCCESS [ 10.921 s]
[INFO] hadoop-mapreduce ................................... SUCCESS [  5.023 s]
[INFO] Apache Hadoop MapReduce Streaming .................. SUCCESS [  9.750 s]
[INFO] Apache Hadoop Distributed Copy ..................... SUCCESS [ 18.753 s]
[INFO] Apache Hadoop Archives ............................. SUCCESS [  4.010 s]
[INFO] Apache Hadoop Rumen ................................ SUCCESS [ 10.000 s]
[INFO] Apache Hadoop Gridmix .............................. SUCCESS [  8.300 s]
[INFO] Apache Hadoop Data Join ............................ SUCCESS [  4.291 s]
[INFO] Apache Hadoop Ant Tasks ............................ SUCCESS [  3.604 s]
[INFO] Apache Hadoop Extras ............................... SUCCESS [  5.445 s]
[INFO] Apache Hadoop Pipes ................................ SUCCESS [  0.062 s]
[INFO] Apache Hadoop OpenStack support .................... SUCCESS [  7.425 s]
[INFO] Apache Hadoop Amazon Web Services support .......... SUCCESS [ 25.584 s]
[INFO] Apache Hadoop Azure support ........................ SUCCESS [ 11.138 s]
[INFO] Apache Hadoop Client ............................... SUCCESS [ 13.385 s]
[INFO] Apache Hadoop Mini-Cluster ......................... SUCCESS [  0.140 s]
[INFO] Apache Hadoop Scheduler Load Simulator ............. SUCCESS [  8.268 s]
[INFO] Apache Hadoop Tools Dist ........................... SUCCESS [ 12.948 s]
[INFO] Apache Hadoop Tools ................................ SUCCESS [  0.047 s]
[INFO] Apache Hadoop Distribution ......................... SUCCESS [ 49.281 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------


Do you think it is easy? Let's have a look at the following post with a list of the most common error messages you could receive (and their causes and solutions as well). Stay tuned!

Comments

Popular posts from this blog

Streamsets Data Collector log shipping and analysis using ElasticSearch, Kibana and... the Streamsets Data Collector

One common use case scenario for the Streamsets Data Collector (SDC) is the log shipping to some system, like ElasticSearch, for real-time analysis. To build a pipeline for this particular purpose in SDC is really simple and fast and doesn't require coding at all. For this quick tutorial I will use the SDC logs as example. The log data will be shipped to Elasticsearch and then visualized through a Kibana dashboard. Basic knowledge of SDC, Elasticsearch and Kibana is required for a better understanding of this post. These are the releases I am referring to for each system involved in this tutorial: JDK 8 Streamsets Data Collector 1.4.0 ElasticSearch 2.3.3 Kibana 4.5.1 Elasticsearch and Kibana installation You should have your Elasticsearch cluster installed and configured and a Kibana instance pointing to that cluster in order to go on with this tutorial. Please refer to the official documentation for these two products in order to complete their installation (if you do

Exporting InfluxDB data to a CVS file

Sometimes you would need to export a sample of the data from an InfluxDB table to a CSV file (for example to allow a data scientist to do some offline analysis using a tool like Jupyter, Zeppelin or Spark Notebook). It is possible to perform this operation through the influx command line client. This is the general syntax: sudo /usr/bin/influx -database '<database_name>' -host '<hostname>' -username '<username>'  -password '<password>' -execute 'select_statement' -format '<format>' > <file_path>/<file_name>.csv where the format could be csv , json or column . Example: sudo /usr/bin/influx -database 'telegraf' -host 'localhost' -username 'admin'  -password '123456789' -execute 'select * from mem' -format 'csv' > /home/googlielmo/influxdb-export/mem-export.csv

Using Rapids cuDF in a Colab notebook

During last Spark+AI Summit Europe 2019 I had a chance to attend a talk from Miguel Martinez  who was presenting Rapids , the new Open Source framework from NVIDIA for GPU accelerated end-to-end Data Science and Analytics. Fig. 1 - Overview of the Rapids eco-system Rapids is a suite of Open Source libraries: cuDF cuML cuGraph cuXFilter I enjoied the presentation and liked the idea of this initiative, so I wanted to start playing with the Rapids libraries in Python on Colab , starting from cuDF, but the first attempt came with an issue that I eventually solved. So in this post I am going to share how I fixed it, with the hope it would be useful to someone else running into the same blocker. I am assuming here you are already familiar with Google Colab. I am using Python 3.x as Python 2 isn't supported by Rapids. Once you have created a new notebook in Colab, you need to check if the runtime for it is set to use Python 3 and uses a GPU as hardware accelerator. You