测试环境:
系统: centos 5.5
安装包: hadoop-0.20.2.tar.gz jdk1.6.0 虚拟机三台: 192.168.1.239为namenode 192.168.1.123为datanode123 192.168.1.222为datanode222目的:
对hadoop安装配置使用做一个初步的认识。为深入研究了学习hadoop做一个铺垫。
1.. 配置ssh无密码登录和hosts文件 2.. 安装 jdk环境 3.. 系统环境变量配置 4.. 安装配置hadoop 1.. 配置ssh无密码登录 使用namenode.hdp.com能够登录两台datanode222和datanode123- ssh-keygen -t rsa
- cat .ssh/id_rsa.pub | ssh hadoop@192.168.1.123 "cat >>/home/hadoop/.ssh/authorized_keys"
- cat .ssh/id_rsa.pub | ssh hadoop@192.168.1.222 "cat >>/home/hadoop/.ssh/authorized_keys"
- #### hadoop
- 192.168.1.239 namenode.hdp.com
- 192.168.1.222 datanode222.hdp.com
- 192.168.1.123 datanode123.hdp.com
- export JAVA_HOME=/usr/local/jdk1.6.0_33
- export JRE_HOME=/usr/local/jdk1.6.0_33/jre
- export CLASSPATH=".:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH"
- export PATH="$JAVA_HOME/bin:$JRE_HOME/bin:$PATH"
- [root@station jdk1.6.0_33]# java -version
- java version "1.6.0_33"
- Java(TM) SE Runtime Environment (build 1.6.0_33-b04)
- Java HotSpot(TM) Client VM (build 20.8-b03, mixed mode, sharing)
- vim hadoop-env.sh
- export JAVA_HOME=/usr/local/jdk1.6.0_33
- vim 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>hadoop.tmp.dir</name>
- <value>/home/hadoop/tmp</value>
- </property>
- <property>
- <name>fs.default.name</name>
- <value>hdfs://namenode.hdp.com:9000</value>
- </property>
- </configuration>
- vim 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>/home/hadoop/name</value>
- </property>
- <property>
- <name>dfs.data.dir</name>
- <value>/home/hadoop/data</value>
- </property>
- <property>
- <name>dfs.replication</name>
- <value>1</value>
- </property>
- </configuration>
- vim 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>
- cd /home/hadoop/hadoop-0.20.2
- ./hadoop namenode -format
点击Live Nodes 进入查看详细信息