[Hadoop] 完全分布式集群安装过程详解

1. 用VMware Workstation创建4个虚拟机,每个虚拟机都装上CentOS(版本:CentOS-6.3-x86_64),示意图如下:

[Hadoop] 完全分布式集群安装过程详解

2. 在所有结点上修改/etc/hosts,使彼此之间都能够用机器名解析IP

192.168.231.131 node01

192.168.231.132 node02

192.168.231.133 node03

192.168.231.134 node04

3. 在所有结点上安装JDK

首先,把jdk安装包(jdk-6u38-linux-x64.bin)放到/usr/Java

增加可执行权限:

[root@localhost java]# chmod a+xjdk-6u38-linux-x64.bin

[root@localhost java]# ls -lrt

total 70376

-rwxr-xr-x. 1 root root 72058033 Jan 2907:21 jdk-6u38-linux-x64.bin

下面开始安装JDK:

[root@localhost java]# ./jdk-6u38-linux-x64.bin

更改/etc/profile,添加以下几行:

JAVA_HOME=/usr/java/jdk1.6.0_38

JRE_HOME=/usr/java/jdk1.6.0_38/jre/

CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

测试是否安装成功:

[root@localhost java]# source /etc/profile

[root@localhost java]# java -version

java version "1.6.0_38"

Java(TM) SE Runtime Environment (build1.6.0_38-b05)

Java HotSpot(TM) 64-Bit Server VM (build20.13-b02, mixed mode)

4. 添加Hadoop用户

[root@node02 ~]# useradd hadoop -g root

[root@node02 ~]# passwd hadoop

Changing password for user hadoop.

New password:

BAD PASSWORD: it is too short

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updatedsuccessfully.

5. ssh 配置

注意:下面开始以hadoop用户操作

[hadoop@node01 ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key(/home/hadoop/.ssh/id_rsa):

Created directory '/home/hadoop/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/hadoop/.ssh/id_rsa.

Your public key has been saved in/home/hadoop/.ssh/id_rsa.pub.

The key fingerprint is:

1d:03:8c:2f:99:95:98:c1:3d:8b:21:61:3e:a9:cb:bfhadoop@node01

The key's randomart image is:

+--[ RSA 2048]----+

| oo.B.. |

| o..* *. |

| +. B oo |

| ..= o. o |

| . .S . |

| . . |

| o |

| . |

| E. |

+-----------------+

[hadoop@node01 ~]$ cd .ssh

[hadoop@node01 .ssh]$ cp id_rsa.pubauthorized_keys

把所有结点的authorized_keys的内容都互相拷贝,这样就可以免密码ssh连入。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/618e6d5fb7b9bac39099de5fa3614c4e.html