Configure Aerospike Database
Aerospike uses a single file to configure a database node. The default location of the configuration file is /etc/aerospike/aerospike.conf
.
The configuration file is divided into different contexts, some of which are optional. These contexts can be in any order in the configuration file. A context can be further divided into sub-contexts.
The maximum length of a line in the configuration file is 1,024 characters. (Prior to Aerospike Server 5.0, the line length limit was 256 characters.)
The following example shows the structure of aerospike.conf
, with the most common contexts and sub-contexts. The contexts shown below are empty and do not have actual parameters, indicated by empty braces {}
. Sub-contexts are indented.
This is not a working configuration example. Do not copy and try to use it as-is. It will not work without adding your parameters.
service {} # Tuning parameters, process owner, feature
# key file
network { # Used to configure intracluster and
# application-node communications
service {} # Tools/Application communications protocol
fabric {} # Intracluster communications protocol
info {} # Administrator telnet console protocol
heartbeat {} # Cluster formation protocol
}
security { # (Optional, Enterprise Edition only) to enable
# access control on the cluster
}
logging {} # Logging configuration
xdr { # (Optional, Enterprise Edition only) Configure
# Cross-Datacenter Replication
}
namespace { # Define namespace record policies and storage
# engine
storage {} # Configure persistence or lack of persistence
set {} # (Optional) Set specific record policies
}
mod-lua { # location of UDF modules
}
The following aerospike.conf
is the default configuration that ships with Aerospike. When you install a new Aerospike instance, you will have a running instance without any modifications. This is sufficient for testing, but for a production system you will probably need to make changes. Refer to the sections following this example to learn more.
# Aerospike database configuration file.
service {
user root
group root
pidfile /var/run/aerospike/asd.pid
proto-fd-max 15000
}
logging {
# Log file must be an absolute path.
file /var/log/aerospike/aerospike.log {
context any info
}
}
network {
service {
address any
port 3000
}
heartbeat {
mode multicast
multicast-group 239.1.99.222
port 9918
# To use unicast-mesh heartbeats, remove the 3 lines above, and see
# aerospike_mesh.conf for alternative.
interval 150
timeout 10
}
fabric {
port 3001
}
info {
port 3003
}
}
namespace test {
replication-factor 2
memory-size 4G
storage-engine memory
}
namespace bar {
replication-factor 2
memory-size 4G
storage-engine memory
# To use file storage backing, comment out the line above and use the
# following lines instead.
# storage-engine device {
# file /opt/aerospike/data/bar.dat
# filesize 16G
# data-in-memory true # Store data in memory in addition to file.
# }
}
You can use any port between 1024 and 65335 for Aerospike, as long as the port is not in use by an existing process.
Configuration Steps
- (Optional) Configure feature key.
- Configure network service and heartbeat sub-contexts.
- Configure namespaces.
- Configuring Log Files and Manually Rotating the Aerospike Log File.
- (Optional) Configure security.
- (Optional) Configure rack-awareness.
- (Optional) Configure cross-datacenter replication.