1.软件下载:
wget http://apache.dataguru.cn/hadoop/common/hadoop-2.7.0/hadoop-2.7.0.tar.gz
wget http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
2.配置安装java:
tar -zxvf jdk-7u79-linux-x64.tar.gz -C /usr/local
cd /usr/local
chown -R root. /usr/local/jdk1.7.0_79
ln -s jdk1.7.0_79 jdk
echo ‘export PATH=/usr/local/java/bin:$PATH;‘ >/etc/profile.d/java.sh
echo ‘export JAVA_HOME=/usr/local/java‘ >>/etc/profile
source /etc/profile.d/java.sh
source /etc/profile
java -version
3.安装hadoop:
useradd hadoop
passwd hadoop
tar -zxvf hadoop-2.7.0.tar.gz -C /usr/local
chown -R hadoop:hadoop /usr/local/hadoop-2.7.0
echo ‘export PATH=/usr/local/hadoop/bin:/usr/local/hadoop/sbin:$PATH;‘>/etc/profile.d/hadoop.sh
source /etc/profile.d/hadoop.sh
hadoop -version
echo ‘127.0.0.1 myhost3‘ >/etc/hosts
修改/usr/local/hadoop/etc/hadoop/hadoop-env.sh的JAVA_HOME为绝对路径:
export JAVA_HOME=/usr/local/java
4.配置hadoop:
su - hadoop
cd /usr/local/hadoop/etc/hadoop;
mkdir -p /home/hadoop/temp
4.1配置core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://myhost3:9000/</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop/temp</value>
</property>
</configuration>
4.2配置mapred-site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>myhost3:9001</value>
</property>
</configuration>
4.3配置hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
4.4配置ssh互信:
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub myhost3
ssh myhost3 "date"
4.5格式化HDFS系统
/usr/local/hadoop/bin/hadoop namenode -format
5.启动hadoop:
start-all.sh
6.检查验证:
[hadoop@myhost3 ~]$ jps
7365 NodeManager
7662 Jps
6800 NameNode
6902 DataNode
7250 ResourceManager
7039 SecondaryNameNode
本文出自 “webseven” 博客,请务必保留此出处http://webseven.blog.51cto.com/4388012/1654787
原文地址:http://webseven.blog.51cto.com/4388012/1654787