1. Hadoop运行模式
1)本地模式:不需要启动单独进程,直接可以运行,测试和开发时使用
2)伪分布式模式:等同于完全分布式,但只有一个节点
3)完全分布式模式:多个节点一起运行
2. Hadoop运行命令解析:
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar grep input output 'dfs[a-z]+'
hadoop命令 执行jar jar所在位置 jar包中的类 输入 输出 具体参数
3. Hadoop常用命令:
1)格式化节点 bin/hdfs namenode -format
2)启动namenode节点 sbin/hadoop-daemon.sh start namenode
3)启动datanode节点 sbin/hadoop-daemon.sh start datanode
4)查看集群 jps
5)查看日志 /opt/modul168e/hadoop-2.7.2/logs
6)web端查看 http://IP地址:50070
7)在Hdfs文件系统上创建一个文件夹
bin/hdfs dfs -mkdir -p /user/atguigu/input
8)将测试文件内容上传到文件系统上
bin/hdfs dfs -put wcinput/wc.input /user/atguigu/input/
9)查看文件
bin/hdfs dfs -ls /user/atguigu/input/
bin/hdfs dfs -cat /user/atguigu/input/wc.input
10)运行mapreduce程序
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount /user/atguigu/input/ /user/atguigu/output
11)下载结果到本地
hadoop fs -get /user/atguigu/output/part-r-00000 ./wcoutput/
12)删除结果
hdfs dfs -rmr /user/atguigu/output