获取 Hadoop 集群的一些配置值。
hdfs version 查看 Hadoop 集群的版本号。
如下是 hdfs 提供的命令:
hdfs getconf
hdfs getconf is utility for getting configuration information from the config file.
hadoop getconf
[-namenodes] gets list of namenodes in the cluster.
[-secondaryNameNodes] gets list of secondary namenodes in the cluster.
[-backupNodes] gets list of backup nodes in the cluster.
[-includeFile] gets the include file path that defines the datanodes that can join the cluster.
[-excludeFile] gets the exclude file path that defines the datanodes that need to decommissioned.
[-nnRpcAddresses] gets the namenode rpc addresses
[-confKey [key]] gets a specific key from the configuration
获取 defaultFS
hdfs getconf -confkey fs.defaultFs
获取 namenodes 节点信息
hdfs getconf -confkey namenodes
获取 namenode rpc 地址信息
用于客户端操作
hdfs getconf -confkey nnRpcAddresses
获取 dfs.nameservices
hdfs getconf -confkey dfs.nameservices
获取 dfs.ha.namenodes.xx
hdfs getconf -confkey dfs.ha.namenodes.xx
获取 dfs.namenode.rpc-address.xx.xxx
其中 nn1 为 ha 节点之一的别名。
RPC Adress 和 HTTP Adress 的区别
RPC 简单讲就是远程过程调用,远程意味着跨节点(机器)。
- 客户端连接 Hadoop 集群使用 RPC 接口