08.08.2020»»суббота

Macos Unable To Load Native-hadoop Library For Your Platform

08.08.2020
Macos Unable To Load Native-hadoop Library For Your Platform Average ratng: 9,4/10 5878 votes
  1. Macos Unable To Load Native-hadoop Library For Your Platform Online

I mentioned this before in my general setup instructions. With the second release of Hadoop this year, it’s now time to talk about how to build the native Hadoop libraries. Here are the instructions you need to build the native libraries.

Why is This Necessary?

If you recall, you see a message similar to this one if you are running on a 64 bit server using the Apache distribution without modification:

I have put this issue is from SO, but nobody answer it, so I hope i can get answer here, thanks! I am using docker-spark 1.3.0. After starting spark-shell, it outputs: 15/05/21 04:28:22 DEBUG NativeCodeLoader: Failed to load native-hadoo. Dec 31, 2017 Unable to load native hadoop library for your platform. Debapratim Karmakar. Sign in to make your opinion count. Load data from local file system and HDFS to Hive table - Duration. Jun 28, 2019  WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform. Using builtin-java classes where applicable. My Hadoop Version is 2.2.0. Doing a search online brought up this link. The /native/directory/ on Hadoop 2.x is different so am confused a bit. I have also edited the Hadoop-env.sh file.

To get around this message, you need to build the libhadoop library for your system. While the procedure to do this isn’t completely obvious, it’s also not that difficult.

Base System

To get started, I started with a system that had this setup:

  • Minimal server (text mode) install of Linux (in my case, I used OpenSuSE 12.3)
  • Basic dev tools already installed: gcc, make
  • Kernel source installed
  • Java 1.7 installed
  • Maven 3.1.1

If you start with this setup, you also need to install these components:

  • g++
  • cmake
  • zlib-developer

First Step: protobuf 2.5

Building the native libraries requires using protobuf 2.5. You may not have this version in your system. You will need to download and build it yourself. You can get the download from https://developers.google.com/protocol-buffers . Download version 2.5, which is the latest version as of this post.

To build protobuf, run these commands from the main protobuf directory:

Once the build has finsihed, run this command to execute the unit tests and verify that protobuf was built successfully:

Look for this in the output:

If you see this, then protobuf was built successfully, and you can move on to building the Hadoop libraries.

Second Step: Building the Hadoop Libraries

To build the Hadoop libraries, start off with a Hadoop distribution archive. (I used Hadoop 2.4 for this post.) Extract the archive, then move into the hadoop-common-project/hadoop-common directory:

Before building, you need to define the location of protoc in the protobuf code:

From this directory, use Maven to build the native code:

Native-hadoop

Look for the typical Maven BUILD SUCCESS message to indicate that you have built the libraries properly:

Maven will generate the libraries in target/native/target/usr/local/lib .

Final step: Copying the libraries into Hadoop

Once the libraries are built, all you need to do is copy them to your Hadoop installation. If you have been following the instructions to set up a cluster on this site, that path is /usr/share/hadoop . Copy the files as the hdfs user since that user has permissions to write to the Hadoop installation:

A third file, libhadoop.so, does not need to be copied since it is just a symbolic link to libhadoop.so.1.0.0.

Checking It All Out

As a final check, once you put the libraries in place, run a Hadoop HDFS command and verify that you no longer get the native library warning.

That’s all you need to do!

  • Native Hadoop Library

Overview

This guide describes the native hadoop library and includes a small discussion about native shared libraries.

Note: Depending on your environment, the term 'native libraries' could refer to all *.so's you need to compile; and, the term 'native compression' could refer to all *.so's you need to compile that are specifically related to compression. Currently, however, this document only addresses the native hadoop library (libhadoop.so).

Besides APFS data recovery, R-Studio also supports file systems such as HFS+, HFS, FAT32, exFAT. Download r for mac mojave.

Macos Unable To Load Native-hadoop Library For Your Platform

Native Hadoop Library

Hadoop has native implementations of certain components for performance reasons and for non-availability of Java implementations. These components are available in a single, dynamically-linked native library called the native hadoop library. On the *nix platforms the library is named libhadoop.so.

Usage

It is fairly easy to use the native hadoop library:

  1. Review the components.
  2. Review the supported platforms.
  3. Either download a hadoop release, which will include a pre-built version of the native hadoop library, or build your own version of the native hadoop library. Whether you download or build, the name for the library is the same: libhadoop.so
  4. Install the compression codec development packages (>zlib-1.2, >gzip-1.2):
    • If you download the library, install one or more development packages - whichever compression codecs you want to use with your deployment.
    • If you build the library, it is mandatory to install both development packages.
  5. Check the runtime log files.

Components

The native hadoop library includes two components, the zlib and gzip compression codecs:

The native hadoop library is imperative for gzip to work.

Supported Platforms

The native hadoop library is supported on *nix platforms only. The library does not to work with Cygwin or the Mac OS X platform.

The native hadoop library is mainly used on the GNU/Linus platform and has been tested on these distributions:

  • RHEL4/Fedora

On all the above distributions a 32/64 bit native hadoop library will work with a respective 32/64 bit jvm.

Download

The pre-built 32-bit i386-Linux native hadoop library is available as part of the hadoop distribution and is located in the lib/native directory. You can download the hadoop distribution from Hadoop Common Releases.

Be sure to install the zlib and/or gzip development packages - whichever compression codecs you want to use with your deployment.

Build

The native hadoop library is written in ANSI C and is built using the GNU autotools-chain (autoconf, autoheader, automake, autoscan, libtool). This means it should be straight-forward to build the library on any platform with a standards-compliant C compiler and the GNU autotools-chain (see the supported platforms).

The packages you need to install on the target platform are:

  • C compiler (e.g. GNU C Compiler)
  • GNU Autools Chain: autoconf, automake, libtool
  • zlib-development package (stable version >= 1.2.0)

Once you installed the prerequisite packages use the standard hadoop build.xml file and pass along the compile.native flag (set to true) to build the native hadoop library:

$ ant -Dcompile.native=true <target>

You should see the newly-built library in:

$ build/native/<platform>/lib

where <platform> is a combination of the system-properties: ${os.name}-${os.arch}-${sun.arch.data.model} (for example, Linux-i386-32).

Please note the following:

  • It is mandatory to install both the zlib and gzip development packages on the target platform in order to build the native hadoop library; however, for deployment it is sufficient to install just one package if you wish to use only one codec.
  • It is necessary to have the correct 32/64 libraries for zlib, depending on the 32/64 bit jvm for the target platform, in order to build and deploy the native hadoop library.

Runtime

The bin/hadoop script ensures that the native hadoop library is on the library path via the system property:
-Djava.library.path=<path>

During runtime, check the hadoop log files for your MapReduce tasks.

  • If everything is all right, then:
    DEBUG util.NativeCodeLoader - Trying to load the custom-built native-hadoop library..
    INFO util.NativeCodeLoader - Loaded the native-hadoop library
  • If something goes wrong, then:
    INFO util.NativeCodeLoader - Unable to load native-hadoop library for your platform.. using builtin-java classes where applicable

Native Shared Libraries

You can load any native shared library using DistributedCache for distributing and symlinking the library files.

This example shows you how to distribute a shared library, mylib.so, and load it from a MapReduce task.

  1. First copy the library to the HDFS:
    bin/hadoop fs -copyFromLocal mylib.so.1 /libraries/mylib.so.1
  2. The job launching program should contain the following:
    DistributedCache.createSymlink(conf);
    DistributedCache.addCacheFile('hdfs://host:port/libraries/mylib.so.1#mylib.so', conf);
  3. The MapReduce task can contain:
    System.loadLibrary('mylib.so');

Macos Unable To Load Native-hadoop Library For Your Platform Online


Note: If you downloaded or built the native hadoop library, you don’t need to use DistibutedCache to make the library available to your MapReduce tasks.