1. 程式人生 > >hadoop 1.2.1 安裝步驟 偽分散式

hadoop 1.2.1 安裝步驟 偽分散式

最近在系統的學習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 由於在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驗證方式

 生成公鑰
[[email protected] .ssh]$ pwd
/export/home/hadoop/.ssh
[[email protected] .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
......
[[email protected] .ssh]$ cp id_rsa.pub authorized_keys
[[email protected] .ssh]$ ls
authorized_keys  id_rsa  id_rsa.pub
 修改hosts檔案:
[[email protected] 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

[[email protected] etc]$ vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=vm.master
 四,修改hadoop配置檔案 [[email protected] conf]$ pwd /export/home/hadoop/hadoop-1.2.1/conf 修改core-site.xml

 
[[email protected] 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

 
[[email protected] 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

 
[[email protected] 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 

   嘗試啟動
 

 搭建完畢