hadoop安装过程
hadoop单机配置(非分布式)
hadoop伪分布式布置
修改配置文件 core-site.xml
修改配置文件 hdfs-site.xml
cd /usr/local/hadoop
./bin/hdfs namenode -format
su ubuntu(hadoop的启动用户)
cd /usr/local/hadoop
./sbin/start-dfs.sh
运行Hadoop伪分布式实例
启动hdfs
查看与创建hadoop用户目录。
在用户目录下创建与查看input目录。
将hadoop的配置文件上传到hdfs上的input目录下。
运行MapReduce示例作业,输出结果放在output目录下
查看output目录下的文件。
查看输出结果
将输出结果文件下载到本地。
查看下载的本地文件。
停止hdfs
当前用户为hadoop
- ./bin/hdfs dfs -mkdir -p /user/hadoop
- ./bin/hdfs dfs -mkdir input
- ./bin/hdfs dfs -put ./etc/hadoop/*.xml input
- ./bin/hdfs dfs -ls input
- ./bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar grep input output 'dfs[a-z.]+'
- ./bin/hdfs dfs -cat output/*
- rm -r ./output
- ./bin/hdfs dfs -get output ./output
- cat ./output/*
- ./sbin/stop-dfs.sh
当前用户不为hadoop时
input要使用绝对路径