Inspect Hadoop configuration using command-line.

Hadoop provides a utility to get necessary configuration information.

$ 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.
        [-journalNodes]                 gets list of journal 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

Display name nodes.

$ hdfs getconf -namenodes
namenode.example.org

Display secondary name nodes.

$ hdfs getconf -secondaryNameNodes
secondarynamenode.example.org

Display name node RPC addresses.

$ hdfs getconf -nnRpcAddresses    
namenode.example.org:9000

Display include file path.

$ hdfs getconf -includeFile
/opt/hadoop/hadoop-3.2.2/etc/hadoop/includes

Display exclude file path.

$ hdfs getconf -excludeFile
Configuration dfs.hosts.exclude is missing.

Display specific configuration key.

$ hdfs getconf -confKey dfs.namenode.datanode.registration.ip-hostname-check
true
$ hdfs getconf -confKey dfs.namenode.checkpoint.period
3600s

Use exit code to determine if configuration key is missing.

ko-fi