最近在系统的学习hadoop
课程第一步是安装hadoop1.x,具体安装步骤如下:
一、系统安装
本文使用centos6.5安装,具体安装步骤省略
二、jdk安装
下载jdk1.7.0_51解压,在环境中
设置环境变量:
vi /etc/profile,添加如下行:
export JAVA_HOME=/usr/local/jdk1.7.0_51
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
由于在centos下安装,选择需要设置jdk版本
update-alternatives --install /usr/bin/java java /export/home/es/jdk1.7.0_51/bin/java 60
update-alternatives --config java
三、linux基本参数设置
设置防火墙:
vi /etc/selinux/config
将红框标示部分,设置为disabled
查看防火墙情况,并关闭
service iptables status
service ip6tables status
service iptables stop
service ip6tables stop
chkconfig iptables off
chkconfig ip6tables off
四,免密码登陆
设置使用免密码登陆方式
vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
将这三个部分的注释去掉,使用RSA验证方式
生成公钥
[hadoop@vm .ssh]$ pwd
/export/home/hadoop/.ssh
[hadoop@vm .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
......
[hadoop@vm .ssh]$ cp id_rsa.pub authorized_keys
[hadoop@vm .ssh]$ ls
authorized_keys id_rsa id_rsa.pub
修改hosts文件:
[hadoop@vm conf]$ more /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
<span>192.168.2.201 vm.master
192.168.2.202 vm.slave1
192.168.2.203 vm.slave2</span>
修改hostname
[hadoop@vm etc]$ vi /etc/sysconfig/network NETWORKING=yes
HOSTNAME=vm.master
四,修改hadoop配置文件
[hadoop@vm conf]$ pwd
/export/home/hadoop/hadoop-1.2.1/conf
修改core-site.xml
[hadoop@vm 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://localhost:9000</value>
</property>
</configuration>
修改hdfs-site.xml
[hadoop@vm 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.replications</name>
<value>1</value>
</property>
</configuration>
修改mapred-site.xml
[hadoop@vm 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>localhost:9001</value>
</property>
</configuration>
设置JAVA_HOME
五,尝试启动
format namenode
尝试启动
搭建完毕
搭建完毕
- 大小: 3.8 KB
- 大小: 5.9 KB
- 大小: 4.6 KB
- 大小: 18.7 KB
- 大小: 10.8 KB
- 大小: 1.5 KB
- 大小: 4.1 KB
- 大小: 4.4 KB
- 大小: 4.1 KB
- 大小: 23 KB
- 大小: 24.9 KB
- 大小: 12.7 KB