下载安装包

Hadoop 配置

core-site.xml

  1. <configuration>
  2. <property>
  3. <name>fs.defaultFS</name>
  4. <value>hdfs://localhost:9000</value>
  5. </property>
  6. <property>
  7. <name>hadoop.tmp.dir</name>
  8. <value>file:/data/hadoop/temp</value>
  9. </property>
  10. </configuration>

hdfs-site.xml

  1. <configuration>
  2. <property>
  3. <name>dfs.replication</name>
  4. <value>1</value>
  5. </property>
  6. <property>
  7. <name>dfs.namenode.name.dir</name>
  8. <value>file:/data/hadoop/temp/dfs/name</value>
  9. </property>
  10. <property>
  11. <name>dfs.datanode.data.dir</name>
  12. <value>file:/data/hadoop/temp/dfs/data</value>
  13. </property>
  14. </configuration>

hadoop-env.sh

  1. export JAVA_HOME=/home/software/jdk1.8.0_231

设置免密 SSH

  1. $ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
  2. $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  3. $ chmod 0600 ~/.ssh/authorized_keys

格式化 NameNode

  1. $ bin/hdfs namenode -format

启动 NameNode 和 DataNode 进程

  1. $ sbin/start-dfs.sh

访问 NameNode

http://localhost:9870/dfshealth.html#tab-overview

image.png