Hadoop集群安装与部署(三节点)
2013-03-04 14:33:51 来源:WEB开发网核心提示:m1.hadoop主机: [root@ s1 .ssh]# useradd hadoop #创建帐号 [root@ s1 .ssh]# passwd hadoop #配置密码 [root@ s1 .ss
m1.hadoop主机:
[root@ s1 .ssh]# useradd hadoop #创建帐号
[root@ s1 .ssh]# passwd hadoop #配置密码
[root@ s1 .ssh 5]# su hadoop
[hadoop@s1 .ssh]$ssh-keygen
[hadoop@s1 .ssh]$chmod 700 ~/.ssh/
[hadoop@m1 .ssh]$ cat id_rsa.pub >> authorized_keys
[hadoop@m1 .ssh]$ scp authorized_keys hadoop@s1.hadoop:/home/hadoop/.ssh/
[hadoop@m1 .ssh]$ scp authorized_keys hadoop@s2.hadoop:/home/hadoop/.ssh/
|
1.2.4 Hadoop多机安装
Hadoop安装与配置过程见1.1.4节,先在m1.hadoop主机配置hadoop,安装hadoop、配置访问权限、配置环境变量:
具体操作过程(m1.hadoop):
[root@m1 home]# tar xzvf hadoop-0.20.2.tar.gz
[root@ m1home]# mv hadoop-0.20.2 /usr/local
[root@ m1home]# cd /usr/local
[root@ m1local]# ls
bin etc games hadoop-0.20.2 include lib lib64 libexec sbin share src
[root@ m1local]# mv hadoop-0.20.2/ hadoop
[root@ m1local]# mkdir hadoop/Data
[root@ m1local]# mkdir hadoop/Name
[root@ m1local]# mkdir hadoop/Tmp
[root@ m1local]# chmod 777 /var/local
[root@ m1local]# ls
bin etc games hadoop include lib lib64 libexec sbin share src
[root@ m1local]# chown -R hadoop:hadoop /usr/local/hadoop/ #修改权限
[root@m1 conf]# vi core-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://m1.hadoop:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/Tmp</value>
</property>
</configuration>
[root@m1 conf]# vi hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.name.dir</name>
<value>/usr/local/hadoop/Name</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>/usr/local/hadoop/Data</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
</configuration>
[root@m1 conf]# vi masters
m1.hadoop
[root@m1 conf]# vi slaves
m1.hadoop
s1.hadoop
s2.hadoop
[root@m1 conf]# vi mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>m1.hadoop:9001</value>
</property>
</configuration>
[root@ m1local]# scp -r /usr/local/hadoop s1.hadoop:/usr/local/
[root@ m1local]# scp -r /usr/local/hadoop s2.hadoop:/usr/local/
|
更多精彩
赞助商链接