Full distributed deployment of Hadoop

Source: Internet
Author: User

The three machines were named:

Hadoop-master  IP:192.168.  0.25Hadoop-slave1   IP:192.168.  0.26    hadoop-slave2   IP:192.168.  0.27

Pre-deployment basic preparation: Three machines common user Hadoop, three machines have been set up static IP and can ping each other, three machine JDK has been installed, the path is the best.

Approximate process:

1. Modify the hostname and add IP and hostname to each other in the/etc/hosts of each machine

2, each machine installs SSH, and realizes master host to slave host no password login

3, Hadoop installation and configuration, remember the path to the same, it is best to/home/hadoop/xxxx

4. Start Hadoop from Master

First, modify the host name

1) Set static IP, refer to http://www.cnblogs.com/jhldreams/p/4161123.html

2) Modify host name

sudo gedit/etc//etc/hosts (add IP and corresponding host in hosts document)

This is the hosts on the master machine, and it's the same in two slave.

Second, install SSH and set up password-free login

sudo apt-get install SSH

Set the password after the installation is finished

$ssh-keygen-t RSA (always enter after executing this command) $cd. SSH (enter the. SSH directory) $CP id_rsa.pub Authorized_keys (where you can already password-free login to this computer, SSH LocalHost can be tested above each machine is done again, but need master host can password-free login slave host, also need to copy Master's public key to two slave node's public key, execute command on master: $SCP authorized_ Keys from the node host name @ name (e.g. [email protected]-slave1):/home/hadoop/644  Authorized_ Keys can then initiate an SSH connection from master to the slave host, enter Yes where Yes is required, and may still need to enter a password the first time the connection is made. The above implementation of access to slave host from master host password-free login problem

Third, install Hadoop on all machines and configure Hadoop

I'm using the hadoop-1.2.1 version.

Go to the official website to download the hadoop-1.2.1 tar package

  

$tar ZXVF xxxx.tar.gz

I did not use sudo decompression, because the Linux permissions problem really scared me, my hadoop is installed under the home file, including the JDK decompression, are useless sudo

After decompression, mainly configure the Hadoop-env.sh,core-site.xml,mapred-site.xml,hdfs-site.xml three files in conf under the Hadoop folder

Hadoop-env.sh in the main find java_home that line, remove the # number, and fill the path as their own JDK path

Core-site.xml

The reason for configuring Hadoop.tmp.dir is to avoid repeating formatting of the HDFs file system, and if the Hadoop.tmp.dir parameter is not configured , the system default temp directory is:/tmp/hadoo-hadoop. And this directory will be deleted after each reboot, you must re -execute format, or else it will be wrong .

  

Hdfs-site.xml

  Replication is the number of copies of data, default is 3,salve less than 3 will be error

  

Mapred-site.xml

  

After doing this, start configuring the Masters file and the slaves file on the master host

   

$CD hadoop-1.2. 1/conf$sudo gedit Masters

Modify the contents of course can also be written before the static ip192.168.0.25

The contents of the configuration slaves file are:

  

To this location, the master host above the configuration has been completed, the slave host and this configuration is basically the same, you can directly copy the Hadoop folder from the master host past (so that the slave host does not need to download Hadoop in advance)

  

$SCP-R hadoop-1.2. 1 [email protected]:/home/hadoop

Slave2 to execute such a command.

Four, start

The first boot requires the format of the Distributed file system, which is not needed later

  

Go to Hadoop folder $cd Hadoop-1.2. 1 $bin/hadoop namenode-format (formatted)

Start

$CD hadoop-1.2. 1 $bin/start-all.sh

You can use the JPS command to view the running process condition

At this point, Hadoop fully distributed has been successfully installed

Full distributed deployment of Hadoop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.