Introduction to Hadoop installation and use

Hadoop runs in three forms:

  • Single instance run
  • Pseudo distributed
  • Fully distributed
    This article focuses on the installation and use of single-instance Hadoop. The following installation and configuration steps are primarily for quick installation and experiencing Hadoop, rather than using Hadoop in a production environment.

Single instance Hadoop

Download

FromHadoop download homepageChoose the appropriate version to download Hadoop.
An example of the command is as follows:

HADOOP_VERSION=hadoop-3.0.0-alpha1
wget http://apache.fayea.com/hadoop/common/${HADOOP_VERSION}/${HADOOP_VERSION}.tar.gz
wget https://dist.apache.org/repos/dist/release/hadoop/common/${HADOOP_VERSION}/${HADOOP_VERSION}.tar.gz.mds
wget https://dist.apache.org/repos/dist/release/hadoop/common/${HADOOP_VERSION}/${HADOOP_VERSION}.tar.gz.asc
wget https://dist.apache.org/repos/dist/release/hadoop/common/KEYS

2. Verification and decompression

  • verification
    The command performs similarly as follows:

    HADOOP_VERSION=hadoop-3.0.0-alpha1
    md5 ${HADOOP_VERSION}.tar.gz | awk '{print $4}' > mycomputation.md5
    sed -n '1,2p' ${HADOOP_VERSION}.tar.gz.mds | sed 's/[ ]//g' | awk -v RS="" -F= '{gsub("\n","");print tolower($2)}' > extraction.md5
    diff mycomputation.md5 extraction.md5
    gpg -q --import KEYS
    gpg --verify ${HADOOP_VERSION}.tar.gz.asc ${HADOOP_VERSION}.tar.gz
    
  • Decompression
    Verify that the downloaded file is extracted and goes to its root directory.
    The command performs similarly as follows:

    HADOOP_VERSION=hadoop-3.0.0-alpha1
    tar xzvf ${HADOOP_VERSION}.tar.gz
    cd ${HADOOP_VERSION}
    

3. Set the JAVA_HOME environment variable

Change settingJAVA_HOME
note:
is by modifying the fileetc/hadoop/hadoop-env.shmiddleJAVA_HOMEAttribute variable.
The example is as follows:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/

4. Test installation is normal

  • By executionbin/hadoop
    execute the commandbin/hadoopNormally, you should display the hadoop command usage documentation.

  • Run the map reduce task
    Execute the following command:

    mkdir input
    cp etc/hadoop/*.xml input
    bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.0-alpha1.jar grep input output 'dfs[a-z.]+'
    cat output/*
    

Pseudo-distributed Hadoop

1. Configuration

  • Edit fileetc/hadoop/core-site.xml:

    <configuration>
        <property>
            <name>fs.defaultFS</name>
            <value>hdfs://localhost:9000</value>
        </property>
    </configuration>
    
  • Edit fileetc/hadoop/hdfs-site.xml:

    <configuration>
        <property>
            <name>dfs.replication</name>
            <value>1</value>
        </property>
    </configuration>
    

2. No password ssh login

Execute the following command:

ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys

3. Execute the test

  1. Format the file system:
    bin/hdfs namenode -format

  2. Start the NameNode daemon and the DataNode daemon:

    sbin/start-dfs.sh
    

Write the log$HADOOP_LOG_DIRDirectory (default is$HADOOP_HOME/logs)。

  1. Browse the web interface of the NameNode:
  1. Create an HDFS directory to perform MapReduce tasks:

    bin/hdfs dfs -mkdir /user
    bin/hdfs dfs -mkdir /user/zhengfq
    
  2. Copy the input file to the distributed file system:

    bin/hdfs dfs -mkdir input
    bin/hdfs dfs -put etc/hadoop/*.xml input
    
  3. Running example:

     bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.0-alpha1.jar grep input output 'dfs[a-z.]+'
    
  4. Check the output:

     bin/hdfs dfs -cat output/*
    
  5. Stop the process:

     sbin/stop-dfs.sh
    

reference

Reprinted at: https://www.jianshu.com/p/e450fe10d003

Intelligent Recommendation

Hadoop --- Introduction and Installation

definition: Big data refers to a collection of data that cannot be captured, managed, and processed with commonly used software tools within a certain time frame, and requires new processing The model...

Hadoop ----- Zookeeper installation and introduction

Introduction to Zookeeper Is a distributed, open source distributed application coordination service It is used to ensure the transaction consistency of data in the cluster key Zookeeper application s...

Hadoop Pig introduction, installation

1. Introduction to Hadoop Pig Second, PIG installation and configuration: 1.PIG installation conditions (1).Hadoop Pig has two run modes: local mode and MapReduce mode. If you need a job to run in a d...

Introduction Hadoop installation and environment

Big Data What is big data? For the "big data" (Big data, Mega data), also known as Big Data. Research firm Gartner gives this definition: "Big Data" is the need for new processing ...

Learning Hadoop (f) - Hadoop Introduction and Installation

1、HadoopBackground What is Hadoop: 1. HADOOP is an open source apache'ssoftware platform 2. HADOOP functions provided: the use of a server cluster according to the user's custom business logic,Distrib...

More Recommendation

Introduction to Hadoop-01 hadoop installation configuration test

Hadoop-Introduction Hadoop can run on general commercial servers, with high fault tolerance, high reliability, high scalability, etc. Especially suitable for writing once and reading many times Suitab...

Hadoop foundation 1: Introduction and installation of Hadoop

Introduction to hadoop: Hadoop platform is a reliable, scalable, and distributed computing open source software. The Apache Hadoop platform is a framework that allows the use of simple programming mod...

#Hadoop notes _1 #hadoop introduction and installation

Because the article is too long, the rest is in my other blogs! Part II: HDFS Part III: MapReduce Part IV: Project Cases 《Hadoop》 Hadoop common command command Description jps View process service ipt...

Hadoop notes (a) installation and use

1, must bind the host name and IP, otherwise the remote will not connect vi /etc/hosts 2, set ssh free login (1) ssh-keygen, always enter (2)ssh-copy-id localhost 3, install Java (1) Install jdk1.8: (...

Hadoop installation and use

The first section of the Hadoop infrastructure configuration 1.0 pre-action: Make the ordinary user I created get administrator rights is as follows 1) Switch to the administrator user, the switching ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top