SingleNode HDFS 搭建过程
2021/9/2 22:36:29
本文主要是介绍SingleNode HDFS 搭建过程,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
背景
1. 纯粹测试 2. 未考虑安全和授权以及数据处理. 3. 单节点最简单的部署, 验证功能连接的可能性
资料获取以及环境变量的设置
- 获取最新的安装文件
https://downloads.apache.org/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gz
- 文件不到600m 大小 下载速度还是可以的.
- 设置环境变量
export PATH=$PATH:/app/server/runtime/java/x86_64-linux/bin/:/hadoop/bin:/hadoop/sbin export HDFS_DATANODE_USER=root export HDFS_NAMENODE_USER=root export HDFS_SECONDARYNAMENODE_USER=root export JAVA_HOME=/app/server/runtime/java/x86_64-linux/
- 注意我这边设置的表简单 直接放到了
/etc/profile.d/app.sh
然后source一下就可以了 - 可以看到我这边使用了比较简单的 root用户运行.
部署单节点的hdfs
- 修改设置变量文件
前提条件, 我讲hadoop 整个目录放到了 /hadoop 里面, 跟环境变量呼应. 修改配置文件 cd /hadoop/etc/hadoop/ hdfs-site.xml 内容设置为 # 注意肯恩需要先设置一下file 后面的路径. # 注意我这边是简单的singleNode 所以replication 设置的是 1. <configuration> <!--指定hdfs保存数据的副本数量--> <property> <name>dfs.replication</name> <value>1</value> </property> <!--指定hdfs中namenode的存储位置--> <property> <name>dfs.namenode.name.dir</name> <value>file:/data/hadoop/tmp/dfs/name</value> </property> <!--指定hdfs中datanode的存储位置--> <property> <name>dfs.datanode.data.dir</name> <value>file:/data/hadoop/tmp/dfs/data</value> </property> </configuration> 修改另一个配置文件 core-site.xml <configuration> <property> <name>fs.defaultFS</name> <value>hdfs://someip:8020</value> </property> <property> <name>hadoop.tmp.dir</name> <value>file:/data/hadoop/tmp</value> </property> <name>fs.checkpoint.period</name> <value>3600</value> </configuration> # 注意需要记住ip地址.
- 进行初始化
直接使用官网介绍的命令就可以 Format the filesystem: $ bin/hdfs namenode -format Start NameNode daemon and DataNode daemon: $ sbin/start-dfs.sh The hadoop daemon log output is written to the $HADOOP_LOG_DIR directory (defaults to $HADOOP_HOME/logs). Browse the web interface for the NameNode; by default it is available at: NameNode - http://localhost:9870/ Make the HDFS directories required to execute MapReduce jobs: $ bin/hdfs dfs -mkdir /user $ bin/hdfs dfs -mkdir /user/<username> Copy the input files into the distributed filesystem: $ bin/hdfs dfs -mkdir input $ bin/hdfs dfs -put etc/hadoop/*.xml input Run some of the examples provided: $ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.3.1.jar grep input output 'dfs[a-z.]+' Examine the output files: Copy the output files from the distributed filesystem to the local filesystem and examine them: $ bin/hdfs dfs -get output output $ cat output/* or View the output files on the distributed filesystem: $ bin/hdfs dfs -cat output/* When you’re done, stop the daemons with: $ sbin/stop-dfs.sh
检查一下部署结果
- 打开网页 http://nodeip:9870
- 展示Node节点的情况的结果
- 展示文件系统, 这里我没考虑权限 好像 控制台权限是没法进行upload和delete的 改天学习下 , 另外不清楚 8020端口的安全设置
- 展示具体的文件夹内的内容
这篇关于SingleNode HDFS 搭建过程的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-28微服务架构中API版本控制的实践
- 2024-09-28AI给的和自己写的Python代码,都无法改变输入框的内容,替换也不行
- 2024-09-27Sentinel配置限流资料:新手入门教程
- 2024-09-27Sentinel配置限流资料详解
- 2024-09-27Sentinel限流资料:新手入门教程
- 2024-09-26Sentinel限流资料入门详解
- 2024-09-26Springboot框架资料:初学者入门教程
- 2024-09-26Springboot框架资料详解:新手入门教程
- 2024-09-26Springboot企业级开发资料:新手入门指南
- 2024-09-26SpringBoot企业级开发资料新手指南