Skip to content

Aerospike tools configuration file

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

Aerospike tools read their startup options from TOML configuration files. Use configuration files to specify commonly used options or to manage multiple options in groups.

Invoke any tool with the --help option to see if it has the capability to read a configuration file.

A tool that supports a configuration file has a help message indicating the allowable options and the group that it belongs to.

Example:

--no-config-file
Do not read any config file. Default: disabled
--instance NAME
Section with this instance is read. For example, if instance `a` is specified,
then sections `cluster_a` and `aql_a` are read.
--config-file PATH
Read this file after default configuration file.
--only-config-file PATH
Read only this configuration file.

Defaults

Aerospike tools read configurations from four possible sources.

File Name and Path (Linux)PurposeRead Order
/etc/aerospike/astools.confGlobal optionsRead first.
~/.aerospike/astools.confUser-specific optionsRead second. If any configurations conflict with the global options, this file takes precedence.
--config-fileA file specified with the optional runtime flag --config-fileRead third. If any configurations conflict with global or user-specific options, this file takes precedence.
Individual runtime configuration parametersParameters passed individually, outside of a fileRead fourth. If any parameters conflict with previously read options, the runtime-specified values take precedence.

How the file is installed

The aerospike-tools bundle installs /etc/aerospike/astools.conf as a package-managed configuration file.

Starting with tools 13.0.3, the individual aerospike-asadm, aerospike-aql, and aerospike-asbackup packages provide the file as well. Each package ships a template at /opt/aerospike/doc/TOOL/astools.conf.sample, where TOOL is the tool name, and copies it to /etc/aerospike/astools.conf during installation only when that file does not already exist. On macOS, the template is at /usr/local/aerospike/doc/TOOL/astools.conf.sample. Because the packages never overwrite the file, your edits survive upgrades and reinstalls, and installing several tools on the same host does not make them conflict over it.

asbench and asconfig do not read astools.conf, so they neither ship a template nor create the file.

The file is optional for every tool that reads it. When it is missing, asadm, aql, asbackup, and asrestore start normally and skip it.

The following describes how to specify options while invoking tools.

Command line syntax

Option typeUsageConstraints
Long optionsUse “equals”: --option=valueNo spaces. No concat.
Short option -PUse “space” or “concat”: -P value or -Pvalue.No equals. A space-separated value must not start with -.
Short option for all othersOnly support “space” or “concat”: -O valueNo equals.

There are some special cases.

  • Provide an empty string for password to trigger a prompt.

  • If the password starts with -, use concat or equals. -P -abc is read as a bare -P followed by another option.

  • If the value in the options has a preceding - (hyphen), you must use an extra space before the hyphen: --tls-protocol=" -all +TLSv1.2"

    Examples
    # the following set the same password using space, concat, and long form
    asadm -U USERNAME -P env:PASSWORD_VARIABLE
    asadm -U USERNAME -Penv:PASSWORD_VARIABLE
    asadm -U USERNAME --password=env:PASSWORD_VARIABLE
    # provide an empty string to trigger a prompt
    asadm -U USERNAME -P
    # if the password starts with -, use concat or equals
    asadm -U USERNAME -P-abc
    asadm -U USERNAME --password=-abc

Password and secret sources

Starting with Tools 13.2.0, asadm, asinfo, aql, asbench, asbackup, asrestore, and asconfig read the --password and --tls-keyfile-password values from the same set of sources. Use env:, file:, or secrets: instead of a literal value to keep passwords out of the process list and out of shell history. b64: and env-b64: only encode the value. Use env:, file:, or secrets: for a password that is hard to pass literally, such as one with quotes, $, or spaces, or one that starts with - or with one of these prefixes. The same forms work in a configuration file, for the tools that read one.

FormValue
env:VARThe value of the environment variable VAR.
env-b64:VARThe base64-decoded value of the environment variable VAR.
b64:VALUEThe base64-decoded VALUE.
file:PATHThe contents of the file at PATH, without the trailing newline.
secrets:...A value fetched from Aerospike Secret Agent.
Anything elseThe literal value.

The following example reads the password from an environment variable:

Terminal window
asadm -U USERNAME -P env:PASSWORD_VARIABLE -e "info"

The following rules apply:

  • A missing environment variable, an unreadable file, an invalid base64 value, or a Secret Agent failure stops the tool with a non-zero exit code.
  • A resolved value is used as is and is not resolved again. A secret whose value starts with env: is used literally.
  • A bare -P still prompts for the password.
  • Secret values never appear in logs or in --help output.

Secret Agent options

The secrets: form needs a running Secret Agent. Use the following options to connect to it. asadm, aql, asbackup, asrestore, and asconfig (generate and diff server) read them from the command line or from the [secret-agent] group, and from [secret-agent_INSTANCE] when you use --instance. asbench does not read astools.conf, so it reads these options from the command line only.

OptionDefaultDescription
--sa-address=HOST[:PORT]127.0.0.1:3005Secret Agent hostname or IP address.
--sa-port=PORT3005Secret Agent port. Overrides a port in --sa-address.
--sa-timeout=MS1000Timeout in milliseconds for Secret Agent requests.
--sa-ca-file=PATHPath to a CA certificate file. Enables TLS to the Secret Agent and verifies its certificate against this CA. The hostname or IP address in --sa-address must be in the certificate.

See Secret usage with backup and restore for examples that use Secret Agent.

Configuration file format

The Aerospike tools configuration file is a plain text file in TOML format that can be created using any text editor.

Any long option supported on the command line when running any Aerospike tool can be provided in a configuration file as well. To get the list of available options for a tool, run it with the --help option. For example: asadm --help.

The syntax for specifying options in a configuration file is similar to command-line syntax. In a configuration file, however, omit the leading two dashes from the option name and specify only one option per line. For example, --port=3000 and --host=localhost on the command line are specified as port=3000 and host="localhost" on separate lines in a configuration file.

Empty lines in the configuration files are ignored. Non-empty lines can take any of the following forms:

# comment
Comment lines start with # or ;. A # comment can start in the middle of a line as well.
[group]
group is the name of the program or group for which you want to set options.
After a group line, any option-setting lines apply to the named group until
the end of the configuration file or another group line is given.
Option group names are not case-sensitive.
opt_name
This is equivalent to --opt_name on the command line.
opt_name=value
This is equivalent to --opt_name=value on the command line.
In a configuration file, you can have spaces around the = character,
something that is not true on the command line. The value optionally
can be enclosed within single quotation marks or double quotation
marks, which is useful if the value contains a # comment character.

Leading and trailing spaces are automatically deleted from option names and values.

The following rules apply to the options and values in the configuration file:

  1. Option values are of string, integer, and boolean type. Strings must be enclosed in double-quotes. Any other value type would fail with an error message.

Some examples:

Terminal window
host="localhost:tls-name:3000"
port=3000
tls-enable=true
  1. Multiple instances of the same option or group in the same file is not allowed.

  2. In case of multiple instances of a given option or group in different file, the last instance takes precedence.

If an option group name is the same as a program name, options in the group apply specifically to that program. For example, the [asadm] and [aql] groups apply to the asadm and the aql program, respectively.

The [cluster] group is read by all tools, under which the connection end point, security and encryption options are specified.

Here is a typical global configuration file:

[cluster]
host="localhost"
port=3000
tls-enable=false
user="" # Empty string is for no user.
[asadm]
service-alumni=false
[aql]
outputmode="table"

Includes

You can use an [include] group in configuration files to specify other configuration files by file path or directory. For example, to include a file at /home/mydir/astools.conf and to read any configuration files found in the /home/mydir directory, include these lines:

[include]
file="/home/mydir/astools.conf"
directory="/home/mydir"

Aerospike makes no guarantee about the order in which configuration files in the directory will be read.

Aerospike reads the options in the following order. Files that are read later overwrite files that are read earlier in case of conflicts.

  1. A configuration file that has an [include] group.
  2. Files specified by [include] and a file path.
  3. Files in an [include] directory.

The contents of an included configuration file should contain groups of options, each preceded by a [group] line that indicates the program to which the options apply.

[cluster]
host="localhost"
[cluster_red]
host="redhost"
[asadm]
timeout=5
[asadm_red]
timeout=1000

Instances

You can append the instance name to a group in the configuration file, which lets you manage groups using the name.

A group name without an instance suffix is considered a global group, and global groups are loaded by default. While invoking tools, you can use the command line option --instance to load a specific instance of a group.

For example:

asadm --instance red

If multiple copies of the same instance are found, the copy that is read last takes precedence.

If the user invokes a tool with asadm --instance red:

  1. Any specific instance overrides a global instance. If both [cluster] and [cluster_red] are specified, then the values in [cluster] are ignored.

  2. In the case where [cluster_red] is not specified, startup fails with an error. To start a program with a certain instance, [cluster_INSTANCE] is compulsory.

  3. In the case of a program specific group, the default is global (that is, if [asadm_red] is not found, options are read from the [asadm] group).

  4. The [include] group does not allow for a suffix, it is only global.