安全认证kerberos
kerberos认证
伪分布部署
完全分布式部署示例1
完全分布式部署示例2
官网信息
# 官网
https://hadoop.apache.org/
# 指定版本文档
https://hadoop.apache.org/docs/r3.3.6/
# 单机部署文档
https://hadoop.apache.org/docs/r3.3.6/hadoop-project-dist/hadoop-common/SingleCluster.html
# 集群部署文档
https://hadoop.apache.org/docs/r3.3.6/hadoop-project-dist/hadoop-common/ClusterSetup.html
hadoop访问界面
http:
获取当前name节点的活动节点
用于获取Hadoop HA(高可用性)中NameNode服务状态的命令。用于检查NameNode服务的状态
hdfs haadmin -getServiceState <servicestate>
hdfs haadmin -getServiceState namenode1
相关操作命令
显示目录列表
bin/hdfs dfs -ls /
创建单机目录
bin/hdfs dfs -mkdir /a
创建多级目录
bin/hdfs dfs -mkdir -p /a/b/c
删除目录
bin/hdfs dfs -rm -r /a
上传文件
bin/hdfs dfs -put a.txt /
查看文件内容
bin/hdfs dfs -cat /a.txt
下载文件
bin/hdfs dfs -get /a.txt
删除文件
bin/hdfs dfs -rm /a.txt
Hadoop命令
hdfs dfs -mkdir /tmp 创建目录
hdfs dfs -mkdir -p /tmp/a/b/c/d 创建多级目录
hdfs dfs -rm -r /tmp/a/b 删除目录
hdfs dfs -ls / 查看目录内容
hadoop fs -ls /
hdfs dfs -ls -R /tmp 递归显示目录
hdfs dfs -put aa.txt /tmp 上传文件
hdfs dfs -rm /tmp/aa.txt 删除文件
hdfs dfs -mv /tmp/aa.txt /tmp/a 文件移动
hdfs dfs -cat /tmp/a/aa.txt 查看文件内容
hdfs dfs -get /tmp/aa.txt 下载文件
hdfs dfs -get /tmp/aa.txt bb.txt 下载文件并且改名字
hdfs dfs -chown aa:bb /tmp 修改目录所有者、所属组
hdfs dfs -chown -R root:supergroup /tmp 修改目录及文件所有者所属组
hdfs dfs -chmod -R 777 /tmp 修改目录权限
代码连接
public class test {
public static void main(String[] args) {
try {
Configuration configuration = new Configuration();
configuration.set("fs.defaultFS","hdfs://localhost:9000");
configuration.set("HADOOP_USER_NAME","root");
FileSystem fileSystem = FileSystem.get(configuration);
fileSystem.close();
log.info("连接成功");
} catch (Exception e) {
}
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)