Verifying Ozone network topology using the CLI

After configuring topology awareness and starting the cluster, run ozone admin printTopology command to verify that the Storage Container Manager (SCM) has applied the correct rack assignments to each DataNode. This check ensures no DataNode is incorrectly assigned to /default-rack due to mapping errors.

Command syntax

ozone admin printTopology [***OPTIONS***]

Command options

Table 1. ozone admin printTopology command options
Option Description
-o or --order Sorts and groups output by network location (rack path).
-f or --full Includes full node information of the topology in the output.
--operational-state [***STATE***] Filters DataNodes by operational state such as IN_SERVICE, DECOMMISSIONING, DECOMMISSIONED, ENTERING_MAINTENANCE or IN_MAINTENANCE.
--node-state [***STATE***] Filters DataNodes by health state such as HEALTHY, STALE, or DEAD.
--scm [***HOST:PORT***] Connects to a specific SCM instance (example, scm-host.example.com:9860).
-id or --service-id [***ID***] Specifies the service ID of the SCM HA cluster.
--json Formats the command output as a JSON object. The JSON output creates an independent array for each node health state (HEALTHY, STALE, DEAD). Each array element is a JSON object representing an individual DataNode. The fields populated in each object depend on whether default formatting or additional flags (such as --full) are applied.
-h or --help Shows command help and exits.
-V or --version Prints version information and exits.

Output examples

Following are the output samples for the ozone admin printTopology with different options:

  • Default output of the command: Without options, the command lists DataNodes grouped by health state such as HEALTHY, STALE, or DEAD. A health-state header is printed only if SCM reports at least one node in that state before filtering. States with zero nodes are omitted entirely. Each node entry under the health state header displays the IP address, hostname, port mapping, operational state, and rack location.

    Command:

    ozone admin printTopology

    Sample output:

    State = HEALTHY
    172.18.0.12(ozone-ha-datanode-3.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_SERVICE    /rack1
    172.18.0.15(ozone-ha-datanode-1.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    DECOMMISSIONED    /rack1
    172.18.0.14(ozone-ha-datanode-5.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_SERVICE    /rack2
    172.18.0.10(ozone-ha-datanode-2.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_MAINTENANCE    /rack2
    State = STALE
    172.18.0.13(ozone-ha-datanode-4.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_SERVICE    /rack2
  • Ordered output (with the --order option): Groups DataNodes first by health state, then alphabetically by rack path. Each DataNode under a rack displays its IP address, hostname, and operational state.

    Command:

    ozone admin printTopology --order

    Sample output:

    State = HEALTHY
    Location: /rack1
     172.18.0.12(ozone-ha-datanode-3.ozone-ha_default) IN_SERVICE
     172.18.0.15(ozone-ha-datanode-1.ozone-ha_default) DECOMMISSIONED
    Location: /rack2
     172.18.0.14(ozone-ha-datanode-5.ozone-ha_default) IN_SERVICE
     172.18.0.10(ozone-ha-datanode-2.ozone-ha_default) IN_MAINTENANCE
    State = STALE
    Location: /rack2
     172.18.0.13(ozone-ha-datanode-4.ozone-ha_default) IN_SERVICE
  • Detailed output (with the --full option): When you run the command with the --full option, the output expands to include the UUID, IP address, hostname, port mapping, operational state, and rack location for each DataNode, grouped by health state.

    Command:

    ozone admin printTopology --full

    Sample output:

    State = HEALTHY
    d669581f-5726-44c0-b73f-f3c2b8a82946/172.18.0.12(ozone-ha-datanode-3.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_SERVICE    /rack1
    d8773b49-5b76-480d-a745-738cc341917f/172.18.0.15(ozone-ha-datanode-1.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    DECOMMISSIONED    /rack1
    20c5a433-58c7-4722-b7ae-9d0d88986958/172.18.0.14(ozone-ha-datanode-5.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_SERVICE    /rack2
    52549926-53e2-4e2c-b542-8d9a25e815d0/172.18.0.10(ozone-ha-datanode-2.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_MAINTENANCE    /rack2
    State = STALE
    2dc9a4d1-64d0-4615-bc2e-36ea661af0e0/172.18.0.13(ozone-ha-datanode-4.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_SERVICE    /rack2
  • Filtering output: Filter the topology display by combining or using --node-state and --operational-state options independently.
    • Command:

      ozone admin printTopology --node-state HEALTHY

      Sample output:

      State = HEALTHY
      172.18.0.12(ozone-ha-datanode-3.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_SERVICE    /rack1
      172.18.0.15(ozone-ha-datanode-1.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    DECOMMISSIONED    /rack1
      172.18.0.14(ozone-ha-datanode-5.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_SERVICE    /rack2
      172.18.0.10(ozone-ha-datanode-2.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    IN_MAINTENANCE    /rack2
      State = STALE
    • Command:

      ozone admin printTopology --operational-state DECOMMISSIONED

      Sample output:

      State = HEALTHY
      172.18.0.15(ozone-ha-datanode-1.ozone-ha_default):HTTP=9882,CLIENT_RPC=19864,REPLICATION=9886,RATIS=9858,RATIS_ADMIN=9857,RATIS_SERVER=9856,RATIS_DATASTREAM=9855,STANDALONE=9859    DECOMMISSIONED    /rack1
      State = STALE