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

  1. ./bin/hdfs dfs -mkdir -p /user/hadoop
  2. ./bin/hdfs dfs -mkdir input
  3. ./bin/hdfs dfs -put ./etc/hadoop/*.xml input
  4. ./bin/hdfs dfs -ls input
  5. ./bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar grep input output 'dfs[a-z.]+'
  6. ./bin/hdfs dfs -cat output/*
  7. rm -r ./output
  8. ./bin/hdfs dfs -get output ./output
  9. cat ./output/*
  10. ./sbin/stop-dfs.sh

当前用户不为hadoop时

input要使用绝对路径

 

posted @ 2021-10-09 18:33  Huang-J  阅读(42)  评论(0编辑  收藏  举报