# Aerospike Admin commands

This page describes the supported `asadm` commands and command modifiers, how to work in a specific command environment, and how to execute commands from a file.

## Overview

`asadm` is Aerospike’s primary tool for managing Aerospike instances at the cluster level.

Some `asadm` commands support one or more modifiers that limit the command’s scope to a specific set of nodes, namespaces, configurations, or metric parameters.

All commands sort output based on the node name that `asadm` chooses for the node. The node name is the Fully Qualified Domain Name (FQDN) or IP if the FQDN cannot be resolved.

## `asadm` arguments

-   `asadm -h [HOST_IP]` connects to the specified host and starts the interactive shell.
-   `asadm -c -f COLLECTINFOPATH` starts the interactive shell in Collectinfo-analyzer mode.

You can also run commands non-interactively.

-   To execute inline commands, run `asadm -e [; separated commands]`. Use `-c` for Collectinfo-analyzer commands.
-   To execute commands from file, run `asadm -e [COMMAND_FILE_PATH]`. Use `-c` for Collectinfo-analyzer commands. For more information, see [Execute commands from a file](#execute-asadm-commands-from-a-file).
-   To send output to a file, run `asadm -e [COMMANDS] -o [OUTPUT_FILE_PATH]`.
-   To use privileged commands, run `asadm --enable -e [commands]`.

## Connect to the admin port

Introduced in Database 8.1.0, the admin port is a reserved communication channel that ensures cluster accessibility, even during application overload scenarios. Configure the admin port in `aerospike.conf`, as follows:

```text
network {

  service {

    port 3000

    address any

  }

  admin {

    port 3003

    address any

  }

  ...

}
```

To connect to a specific node over the admin port, launch `asadm` with the host and port flags:

```text
asadm -h HOST_IP -p ADMIN_PORT
```

When using the admin port, cluster discovery is disabled and `asadm` connects only to the specified node. When connected, `asadm` confirms the admin port connection, and the `Admin>` prompt changes to uppercase.

```text
asadm -h 172.18.0.2 -p 3003

Found 1 nodes

Online:  172.18.0.2:3003

Connected via admin port. Note: Cluster discovery is disabled for admin ports.

ADMIN>
```

## Run `asadm` commands

At the `Admin` prompt, all commands except `enable` support shortest-prefix execution and tab completion. For example:

-   `i<tab>` completes to `info`.
-   `s<tab>` suggests `show` and `summary`.
-   You can execute commands using their shortest unambiguous prefix. For example:
    -   To run `info`, enter `i`.
    -   To run `info network`, enter `i net`. Note that `i n` is ambiguous with `info namespace` and `info network`.

Example: Running short form commands

```text
Admin> i net

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Network Information (2020-12-18 18:15:50 UTC)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      Cluster|                          Node|         Node ID|             IP|     Build|Migrations|~~~~~~~~~~~~~~~~~~Cluster~~~~~~~~~~~~~~~~~~|Client|  Uptime

             |                              |                |               |          |          |Size|         Key|Integrity|      Principal| Conns|

bob-cluster-a|  10-0-0-1.heln.qwest.net:3000| BB9010016AE4202|  10.0.0.1:3000|E-4.9.0.18|   0.000  |   2|C3F2BCB417C3|True     |BB9020016AE4202|     4|00:04:59

bob-cluster-a|  10-0-0-2.heln.qwest.net:3000|*BB9020016AE4202|  10.0.0.2:3000|E-4.9.0.18|   0.000  |   2|C3F2BCB417C3|True     |BB9020016AE4202|     3|00:04:59

Number of rows: 2

Admin> i n

ERR: Ambiguous command: 'n' may be namespace or network.
```

## List of `asadm` commands

The following commands are available with the `asadm` tool:

| Command | Purpose |
| --- | --- |
| asinfo | Provides raw access to the info protocol. |
| collectinfo | Collects cluster info, system stats, and the Aerospike configuration file for the local node. |
| collectlogs | Collects cluster logs. |
| disable | Exits privileged mode. |
| enable | Enters privileged mode. |
| exit | Terminate session. |
| features | Lists the features in use in a running Aerospike cluster. |
| info | Provides summary tables for various aspects of Aerospike functionality. |
| manage | Administrative tasks like managing users, roles, UDFs, and sindexes. |
| pager | Turn terminal pager on or off. |
| show | A collection of commands used to display information about the Aerospike cluster. |
| summary | Displays a summary of the Aerospike cluster, including the amount of [unique data](https://aerospike.com/docs/database/reference/faq/#how-is-unique-data-counted). |
| watch | Runs a command for a specified pause and iterations. |

## List of `asadm` command options

There are a number of options that you can use with the `asadm` command.

| Option | Purpose |
| --- | --- |
| `-V --version` | Show the version of `asadm` and exit. |
| `-E --help` | Show program usage. |
| `-e --execute` | Execute one or more `asadm` commands and exit. The input value is either string of ’;’ separated `asadm` commands or path of file which has `asadm` commands (ends with ’;’). |
| `--enable` | Run commands in privileged mode. Must be used with the `--execute` option. Not allowed in interactive mode. |
| `-o --out-file` | Path of file to write output of -e command\[s\]. |
| `--no-color` | Disable colored output. |
| `--single-node` | Enable asadm mode to connect only to the seed node. By default `asadm` connects to all nodes in cluster. |
| `--collectinfo` | Start `asadm` in Collectinfo-analyzer mode, running against offline collectinfo files instead of the live cluster. You must provide the path to a valid collectinfo archive or directory. For example, `asadm --collectinfo -f /tmp/collect_info_20260123_231419`. |
| `--pmap` | Include partition map analysis in collectinfo files. |
| `--log-analyser` | Start `asadm` in log-analyser mode and analyse data from log files. |
| `-f --log-path=path` | Path of cluster collectinfo file or directory containing collectinfo and system info files. |
| `-j --json` | Output as JSON (experimental). |

## Command modifiers

The following sections describe the supported `asadm` command modifiers.

### diff

The `diff` modifier shows the difference between the configurations in all nodes of the cluster.

| Command | Purpose | Example | Additional Notes |
| --- | --- | --- | --- |
| `show config` | Show differences in service configurations. | `show config service diff` | Only the `show config` command supports `diff`. |

### for

The `for` modifier shows the output for specific namespaces, sets, or datacenters. The following commands support the `for` modifier:

| Command | Purpose | Example | Additional Notes |
| --- | --- | --- | --- |
| `show distribution` | Show distribution for namespace that has the substring `test`. | `show distribution for test` |  |
| `show latencies` | Show latency for namespace that has substrings `test` or `bar`. | `show latencies for test bar` |  |
| `show statistics set` | Show statistics for set that has substring `ABCD` or ends with `XYZ` for a namespace that starts with `test`. | `show statistics set for ^test.* ABCD .*XYZ$` | This command accepts two patterns after `for`: first value is for namespace, and second value for set. |
| `show statistics sindex` | Show statistics for sindex named `ABCD` for namespace `test`. | `show statistics sindex for test ^ABCD$` | This command accepts two patterns after `for`: first value for namespace, and second value for sindex. |
| `show statistics xdr dc` and `show config xdr dc` | Show statistics for XDR datacenters `DC1` and `DC2` | `show statistics xdr dc for DC1 DC2` | The two commands accept multiple `for` modifiers to filter by datacenter. |
| `show statistics xdr namespace` and `show config xdr namespace` | Show statistics for XDR namespace `test` on DC1 | `show statistics xdr namespace for test DC1` | The two commands accept two patterns after `for`: first value for namespace, and second value for datacenter. |
| `show stop-writes` | Show configured stop-writes for namespace `test` and set `testset`. | `show stop-writes for test testset` | This command accepts two patterns after `for`: first value for namespace, and second value for set. |

### like

The `like` modifier shows only results that contain the specified string. Use this with `show statistics` and `show config` commands.

| Command | Purpose | Example | Additional Notes |
| --- | --- | --- | --- |
| `show statistics` | Show namespace statistics with substring `object`. | `show statistics namespace like object` |  |

### with

The `with` modifier specifies a list of nodes to be used with the given command.

::: caution
Use the `with` modifier only in live cluster mode.
:::

| Command | Purpose | Example | Additional Notes |
| --- | --- | --- | --- |
| `manage config` | Set the `aggr` logging context to `info` for nodes prefixed with `10.0`. | See the following example. | Use the node’s IP, FQDN, or Node ID. If multiple nodes share the same IP, use IP:PORT instead of IP. Use the `*` wildcard to search for prefix matches. |

```text
Admin+> manage config logging file /var/log/aerospike/aerospike.log param aggr to info with 10.0.*

~Set Logging Param aggr to info~

          Node|Response

10.0.0.1:3000|ok

10.0.0.2:3000|ok

10.0.0.3:3000|ok

Number of rows: 3
```

## Execute `asadm` commands from a file

You can execute multiple commands from a file with the `-e` option. The command file has the following syntax rules:

-   Commands must end with `;`.
-   Commands can be separated on multiple lines.
-   The file contains commands for a single node only.
-   Single-line comments start with `//`.
-   Multiple-line comments start with `/*` and end with `*/`.

Command file example

```text
show config;

info namespace;

// This is a single-line comment

show

 statistics;

/* This is a multiple-line comment - line 1

This is multiple-line comment - line 2 */

show statistics like obj;
```