Use asconfig to manage your Aerospike configuration.
asconfig
is in beta. Functionality and issues may change rapidly. If you have suggestions, issues, or would like to contribute code, please post an issue or open a pull request on the asconfig GitHub repository.
Overview
Manage your Aerospike configuration
Functionality includes converting between YAML and Aerospike server configuration format, validating configuration files against versioned schemas, and diffing configuration files. The configuration format is shared with the Aerospike cluster Custom Resource.
To get started you can copy an example below or load the schema into your IDE.
Run asconfig convert -a AEROSPIKE-VERSION CONFIG.YAML
to convert your YAML configuration to an Aerospike configuration file.
You can use the converted file to configure the Aerospike database.
Installing
asconfig
is included in Aerospike tools package 8.3.0 and later in deb, RPM, and Mac .pkg formats.
Directions for installing from source are at the asconfig GitHub repository.
Usage
asconfig COMMAND [flags] [arguments]
Supported Commands
Command | Description |
---|---|
completion [flags] SHELL | Generate the autocompletion script for the specified shell |
convert [flags] PATH/TO/CONFIG | Convert between YAML and Aerospike configuration format |
diff [flags] PATH/TO/CONFIG1 PATH/TO/CONFIG2 | Find differences between configuration files |
help [command] | Help about any command |
Usage examples
Convert
Convert between YAML and Aerospike configuration while performing schema validation with the 'convert' command.
This validation ensures that Aerospike configuration files used with asconfig
run with the specified version of the Aerospike server.
Convert local file aerospike.yaml
to the Aerospike configuration format, validating for Aerospike server 6.2.0.x, and
write it to local file, aerospike.conf
.
asconfig convert --aerospike-version "6.2.0" aerospike.yaml --output aerospike.conf
Short form flags and source file only conversions are also supported.
In this case, -a
is the server version and using only a source file means
the result is written to stdout.
asconfig convert -a "6.2.0" aerospike.yaml
Convert local file aerospike.conf
to YAML format, validating for Aerospike server 6.2.0.x, and
write it to local file, aerospike.yaml
.
asconfig convert --aerospike-version "6.2.0" aerospike.conf --output aerospike.yaml
Diff
The diff
command points out missing and differing items in Aerospike configuration files.
diff
works with any file format supported by asconfig
, as long as all input files are the same format.
Find differences in Aerospike configuration files.
asconfig diff cluster_1.conf cluster_2.conf
Differences shown from cluster_1.conf to cluster_2.conf, '<' are from file1, '>' are from file2.
namespaces.{test}.index-type.mounts:
<: [/test/dev/xvdf-index]
>: [/mnt/pmem1]
namespaces.{test}.index-type.mounts-size-limit:
<: 4294967296
>: 1073741824
namespaces.{test}.index-type.type:
<: flash
>: pmem
<: namespaces.{test}.storage-engine.devices
>: namespaces.{test}.storage-engine.files
>: namespaces.{test}.storage-engine.filesize
namespaces.{test}.storage-engine.type:
<: device
>: pmem
network.heartbeat.mode:
<: mesh
>: multicast
Editor-supported, real-time schema validation
Although asconfig
validates your configuration file at conversion time, we recommend that you install the Red Hat YAML VS Code extension.
The extension allows using the Aerospike configuration JSON schema files for code suggestions in VS Code when creating your own YAML configuration.
The JSON schema files used by asconfig
and in this example are stored in the Aerospike schemas Github repository. To write your own YAML configuration file, clone the repository and follow the example below.
Example
You can load schema files into most IDE's to get code suggestions. The following steps detail this process in VS Code.
Install the Red Hat YAML VS Code extension.
In VS Code, go to preferences, then settings. Search for "YAML schema" and click "edit in settings.json".
Use the following example to add a yaml.schemas mapping to your settings.json. Replace "/absolute/path/to/schemas/repo" with the path to your local clone of the Aerospike schemas repo.
"yaml.schemas": {
"/absolute/path/to/schemas/repo/json/aerospike/6.2.0.json": ["/*aerospike.yaml"]
}This will associate all files ending in "aerospike.yaml" with the 6.2.0 Aerospike YAML schema.
Now you can use the code suggestions from the 6.2.0 Aerospike YAML schema to write your YAML configuration.
Configuration examples
Here is an example YAML configuration file and the command to convert it to an Aerospike configuration file for server 6.2.0.x.
example.yaml
service:
feature-key-file: /etc/aerospike/features.conf
logging:
- name: console
any: info
network:
service:
port: 3000
fabric:
port: 3001
heartbeat:
mode: mesh
port: 3002
addresses:
- local
xdr:
dcs:
- name: elastic
connector: true
node-address-ports:
- 0.0.0.0 8080
namespaces:
- name: test
namespaces:
- name: test
memory-size: 3000000000
replication-factor: 2
storage-engine:
type: device
files:
- /opt/aerospike/data/test.dat
filesize: 2000000000
data-in-memory: true
Convert
asconfig convert -a 6.2.0 example.yaml -o example.conf
Example.conf is now ready to configure the Aerospike database.
For more examples see the aerospikeConfig
property from the Aerospike Kubernetes Operator examples.