前提
系统:centos 7.3.1611
java:jdk 1.8
hadoop版本:2.6.5
安装
配置etc/hadoop/core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://10.110.18.216:8020</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/data/tmp</value>
</property>
</configuration>
配置etc/hadoop/hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
对hdfs的namenode格式化
hdfs namenode -format
启动namenode,datanode
hadoop-daemon.sh start namenode
hadoop-daemon.sh start datanode
或者是
sbin/start-dfs.sh
查看服务是否启动
jps
运行
创建目录
bin/hdfs dfs -mkdir -p /user/kevin
上传文件
bin/hdfs dfs -put etc/hadoop /user/kevin/input
运行脚本
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.5.jar grep /user/kevin/input /user/kevin/output 'dfs[a-z.]+'
浏览器
查看hdfs的页面http://10.110.18.216:50070
关闭服务
sbin/stop-dfs.sh