1.解压hadoop
tar -zvxf hadoop-1.2.1.tar.gz
2.重命名
mv hadoop-1.2.1 hadoop
3.环境变量配置
vi /etc/profile
export JAVA_HOME=/usr/local/jdk1.8
export HADOOP_HOME=/etc/local/hadoop
export PATH=.:$HADOOP_HOME/bin:$JAVA_HOME/bin:$PATH
4.修改hadoop配置文件
1)hadoop-env.sh
注释放开:export JAVA_HOME=......
2).core-site.xml:
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://hadoop:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/tmp</value>
</property>
</configuration>
注:hadoop为主机名
3)hadoop-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
</configuration>
4) mapred-site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>hadoop:9001</value>
</property>
</configuration>
5.hadoop格式化
hadoop namenode -format
6.启动
start-all.sh
验证:
查看java进程:jps
有5个java进程:
2660 NameNode
3078 TaskTracker
2902 SecondaryNameNode
2972 JobTracker
2782 DataNode
window ip绑定
C:\Windows\System32\drivers\etc\hosts
192.168.0.108 hadoop
浏览器:http://hadoop:50070
http://hadoop:50030
注:多次格式化会报错,解决:
删除/usr/local/hadoop/tmp文件夹,再执行格式化