在hadoop下新建tmp、hdfs/data、hdfs/name文件夹
core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://192.168.2.39:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/root/software/hadoop/tmp</value>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131702</value>
</property>
</configuration>
hadoop-env.sh
export JAVA_HOME=/root/software/jdk1.8
mapred-site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>192.168.2.39:9001</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
<value>127.0.0.1:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>127.0.0.1:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>127.0.0.1:8031</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>127.0.0.1:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>127.0.0.1:8088</value>
</property>
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>768</value>
</property>
</configuration>
hdfs-core.xml
<configuration>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/root/software/hadoop/hdfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/root/software/hadoop/hdfs/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>127.0.0.1:9001</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value></property>
</configuration>
首先格式化所有节点
bin/hadoop -format namenode
启动hadoop
sbin/hadoop start-all.sh
验证namenode 是否启动可以使用
jps查看namenode
停止hadoop
sbin/hadoop stop-all.sh