hadoop 配置文件说明
2021-09-17 本文已影响0人
V_6619
在hadoop文件夹的etc/core-site.xml写入如下配置文件,
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://hadoop000:8020</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop/app/tmp</value>
</property>
在 etc/hdfs-site.xml中,
调整文件副本,因为现在是单机模拟
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
/home/hadoop/app/tmp/dfs/data/current/BP-800762789-192.168.31.233-1631841044052/current/finalized/subdir0/subdir0
http://192.168.31.233:50070/explorer.html#/
可以看到具体的block信息,和hdfs网页版完全对应
比如


slaves
指的是dataNodes节点
启动HDFS
在 ./profile_bash 中配置Hadoop的环境变量,
进入bin 目录下,输入 hdfs,可以看到hdfs的好多命令

- 格式化hdfs文件系统
hdfs namenode -format
- 启动集群(单机版) 在$HADOOP_HOME/sbin/start-dfs.sh
./start-dfs.sh

可以查看进程验证是否跑成功
jps

也可以在浏览器输入地址,我的地址为 http://192.168.31.233:50070/
注意,这里要改成自己配置的ip和端口

如果发现 jps 是好的,但是浏览器打不开,可能是防火墙问题,那么在终端输入
firewall-cmd --state
来查看自己的防火墙状态,注意关掉自己的防火墙以后,要禁止开机自动启动防火墙
systemctl disable firewalld.service
停止hdfs
./stop-dfs.sh
注意理解 start/stop-dfs.sh 与hadoop-daemons.sh 的关系
start-dfs.sh =
hadoop-daemons.sh start namenode
hadoop-daemons.sh start
hadoop-daemons.sh start secondarynamenode