单机伪分布式Hadoop 启动流程(mac10.10.3 ,hadoop-2.5.2)
需要注意的是,mac版的单机版,每次启动前,记得要把"hdfs"文件夹删掉,每次会自动重建新的"hdfs"(包含"name"和"data"),如果不删就会和新文件冲突。
$HADOOP_HOME/bin/hadoop namenode -format
$HADOOP_HOME/sbin/start-all.sh
$HADOOP_HOME/bin/hadoop fs -mkdir -p input
$HADOOP_HOME/bin/hadoop fs -ls
$HADOOP_HOME/bin/hadoop fs -put /Users/zhangdebin/Documents/helloword.txt
input
$HADOOP_HOME/bin/hadoop fs -put /Users/zhangdebin/Documents/hellohadoop.txt input
$HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.5.2-sources.jar
org.apache.hadoop.examples.WordCount input output
$HADOOP_HOME/bin/hadoop fs -cat output/*
$HADOOP_HOME/bin/hadoop fs -rm -r output
$HADOOP_HOME/sbin/stop-all.sh