Hadoop is an entry-level toy in my Ubuntu-Linux environment. It has been installed many times, so I love Ubuntu and VIM. This article is intended for beginners of Ubuntu-Linux and Hadoop. It records how to build a Hadoop cluster on multiple computers. Take two computers as an example. 1. Make sure that the usernames of all computers are the same when creating a user. Here, the user name is www.linuxidc.com _. Then we have two users distributed on www.linuxidc.com _ 1-desktop,
Hadoop is an entry-level toy in my Ubuntu-Linux environment. It has been installed many times, so I love Ubuntu and VIM. This article is intended for beginners of Ubuntu-Linux and Hadoop. It records how to build a Hadoop cluster on multiple computers. Take two computers as an example.
1. Create a user
Make sure that the user names of all computers are the same, and the names are www.linuxidc.com _.
Then we have two users distributed on www.linuxidc.com _ 1-desktop and www.linuxidc.com _ 2-desktop:
Www.linuxidc.com_@www.linuxidc.com _ 1-desktop
Www.linuxidc.com_@www.linuxidc.com _ 2-desktop
2. After modifying the hostsifconfig command, we know the IP addresses of www.linuxidc.com _ 1-desktop and www.linuxidc.com _ 2-desktop. Here:
192.168.0.1
192.168.0.2
After the sudo vi/etc/hosts command, we delete the original IPv4 content of the hosts files of the two and then modify them as follows:
192.168.0.1 www.linuxidc.com _ 1-desktop
192.168.0.2 www.linuxidc.com _ 2-desktop
Ping yourself and the other party on both computers to check whether the hosts file is correctly configured.
Ping www.linuxidc.com _ 1-desktop
Ping www.linuxidc.com _ 2-desktop
Note: This step is hard to detect if a problem occurs, when we passed the hadoop dfsadmin-report command in the later stage, we carefully observed the differences between the results of the two computers to find out the problems in hosts file settings.
3. SSHsudo apt-get install ssh rsync
To avoid entering a password during ssh Login, We need to generate a public key and a private key, and add the public key to authorization.
In ~ /Directory
Mkdir. ssh
Create an ssh folder
Cd. ssh
Ssh-keygen-t rsa
Then, press ENTER for all the following options.
Then, you can view the files in ls to see that two files are generated.
Id_rsa id_rsa.pub
Then add the public key to authorization
Cp id_rsa.pub authorized_keys
Then copy the whole. ssh folder to another computer, such as copying from local to www.linuxidc.com_@www.linuxidc.com _ 2-desktop ~ /Directory
Scp-r ~ /. Ssh www.linuxidc.com_@www.linuxidc.com _ 2-desktop :~ /
Then
Ssh www.linuxidc.com_@www.linuxidc.com _ 1-desktop
Ssh www.linuxidc.com_@www.linuxidc.com _ 2-desktop
If you can log on successfully without a password, the configuration is successful.
Note: After hadoop is successfully installed, if you need to reconfigure the. ssh file, make sure that all hadoop-related processes are disabled. Otherwise, an error occurs during ssh.
4. JDK http: // www.oracle.com/technetwork/java/javase/downloads/index.htmldownload JDK
Jdk-7u2-linux-i586.tar.gz
Decompress ~ /Directory, and then set the environment variable
Sudo vi/etc/profile
Add the following code at the end of the file:
JAVA_HOME =/home/www.linuxidc.com _/jdk1.7.0 _ 02
Export JRE_HOME = $ JAVA_HOME/jre
Export CLASSPATH =.: $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH
Export PATH = $ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH
Repeat the above steps on each computer (scp is acceptable)