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
Asconfig converts yaml to validated Aerospike configuration. This allows you to manage and create Aerospike configuration files in yaml using a versioned schema directory. This configuration 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.
The converted file can be used to configure the Aerospike database.
Installing
asconfig
is included in the Aerospike tools package in deb, RPM, and Mac .pkg formats.
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.yaml | Convert YAML to Aerospike configuration format |
help [command] | Help about any command |
Usage examples
Convert local file aerospike.yaml
to the Aerospike configuration format for Aerospike server version 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
Editor-supported, real-time schema validation
Although asconfig
will validate your configuration file at conversion time we recommend that you install the Red Hat YAML vscode 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 asconfig
schema directory. To write your own YAML configuration file, clone the asconfig
GitHub 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".
Add a yaml.schemas mapping like the one below to your settings.json. Replace "/absolute/path/to/asconfig/repo" with the path to your local clone of the asconfig repo.
"yaml.schemas": {
"/absolute/path/to/asconfig/repo/schema/json/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 database version 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.