前言
安裝模式
環境
前提條件
僞分佈式模式安裝
/etc/profile配置環境變量
export HADOOP_HOME=/home/wsx/opt/hadoop-2.8.5
export PATH=${HADOOP_HOME}/bin:${HADOOP_HOME}/sbin:$PATH
${HADOOP_HOME}/etc/hadoop/hadoop-env.sh
export JAVA_HOME=/home/wsx/opt/jdk1.8.0_241
${HADOOP_HOME}/etc/hadoop/core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/wsx/opt/hadoop-2.8.5/tmp</value>
</property>
</configuration>
${HADOOP_HOME}/etc/hadoop/hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
${HADOOP_HOME}/etc/hadoop/mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
${HADOOP_HOME}/etc/hadoop/yarn-site.xml
<configuration>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>localhost</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
使環境變量生效
格式化hdfs
hdfs namenode -format
啓動hadoop
start-dfs.sh
start-yarn.sh
執行jps命令
- 以下進程全部運行表明啓動成功
- NameNode,SecondaryNameNode,DataNode
- ResourceManager,NodeManager
運行WordCount
echo "hello hi he he" > test.txt
haddop fs -mkdir /input
hadoop fs -put test.txt /input/
cd /home/wsx/opt/hadoop-2.8.5/share/hadoop/mapreduce
hadoop jar hadoop-mapreduce-examples-2.8.5.jar WordCount /input/ /output/