Hadoop实验
-
先单机下载、安装hadoop,启动:
bin/hdfs namenode -format sbin/start-all.sh
![image-20230420185642321](https://gitee.com/CaoZhongyang/cartographic-bed/raw/master/https://gitee.com/CaoZhongyang/cartographic-bed/202304201856385.png)
-
腾讯云新建三个机器,分别在两地(香港二区、香港三区),分别命名为master、slave1、slave2。
-
修改四个配置文件
运行hadoop:
![image-20230427185622728](https://gitee.com/CaoZhongyang/cartographic-bed/raw/master/https://gitee.com/CaoZhongyang/cartographic-bed/202304271856826.png)
分别查看三台机器运行状态:
![image-20230427191104719](https://gitee.com/CaoZhongyang/cartographic-bed/raw/master/https://gitee.com/CaoZhongyang/cartographic-bed/202304271911744.png)
![image-20230427190323140](https://gitee.com/CaoZhongyang/cartographic-bed/raw/master/https://gitee.com/CaoZhongyang/cartographic-bed/202304271903163.png)
![image-20230427190345849](https://gitee.com/CaoZhongyang/cartographic-bed/raw/master/https://gitee.com/CaoZhongyang/cartographic-bed/202304271903877.png)
查看HDFS运行状态:
![image-20230427193451215](https://gitee.com/CaoZhongyang/cartographic-bed/raw/master/https://gitee.com/CaoZhongyang/cartographic-bed/202304271934246.png)
通过hdfs创建czy文件夹、上传文件
bin/hdfs dfs -mkdir -p /user/ubuntu
bin/hdfs dfs -mkdir czy
bin/hdfs dfs -put ./etc/hadoop/core-site.xml czy
![image-20230427185947058](https://gitee.com/CaoZhongyang/cartographic-bed/raw/master/https://gitee.com/CaoZhongyang/cartographic-bed/202304271859089.png)
通过dfs将测试文件上传,查看该文件:
![image-20230427194145395](https://gitee.com/CaoZhongyang/cartographic-bed/raw/master/https://gitee.com/CaoZhongyang/cartographic-bed/202304271941423.png)
ps:每次重启hadoop,需要把/usr/local/hadoop/tmp/dfs/data下的所有内容删掉,因为hadoop不会自己覆盖而是报错
标签:bin,hdfs,czy,数据库,Hadoop,dfs,hadoop,实验 From: https://www.cnblogs.com/czy-blogs/p/17471887.html