hadoop入门配置
准备环境:cetnos6.9、java-1.7.0-openjdk-1.7.0.191.x86_64、hadoop1.2.1
编辑配置文件
- hadoop-env.sh:
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.191.x86_64
- core.site.xml:
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/hadoop</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://192.168.1.111:9000</value>
</property>
</configuration>
- hdfs.site.xml
<configuration>
<property>
<name>dfs.data.dir</name>
<value>/hadoop/data</value>
</property>
</configuration>
- mapred.site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>192.168.1.111:9001</value>
</property>
</configuration>
- /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.191.x86_64
export JRE_HOME=$JAVA_HOME/jre
export HADOOP_HOME=/opt/hadoop-1.2.1
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$HADOOP_HOME/bin
输入 hadoop 命令验证环境变量是否生效
执行hadoop命令
1.格式化namenode:hadoop namenode -format
2.启动hadoop:start-all.sh,通过jps命令查看是否启动成功
3.查看hdfs目录:hadoop fs -ls /