Skip to content

Data in memory with file persistence for Aerospike on Kubernetes

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

This example lets you store namespace data both in memory and on the persistent device. For more information on data in memory with persistence and other storage configurations, see the Aerospike documentation for namespace storage configuration.

The ns volume in the following example holds the persistence file. Its StorageClass must be backed by local storage or by a dedicated network block volume, such as one from the Amazon EBS CSI driver. Don’t use a StorageClass backed by shared storage, such as Ceph through Rook. See Non-local storage.

Configure file persistence

  1. Add the following storage-specific configuration to the Aerospike cluster’s CR file.

    storage:
    filesystemVolumePolicy:
    cascadeDelete: true
    initMethod: deleteFiles
    blockVolumePolicy:
    cascadeDelete: true
    volumes:
    - name: workdir
    aerospike:
    path: /opt/aerospike
    source:
    persistentVolume:
    storageClass: ssd
    volumeMode: Filesystem
    size: 1Gi
    - name: ns
    aerospike:
    path: /opt/aerospike/data
    source:
    persistentVolume:
    storageClass: ssd
    volumeMode: Filesystem
    size: 3Gi
    - name: aerospike-config-secret
    source:
    secret:
    secretName: aerospike-secret
    aerospike:
    path: /etc/aerospike/secret
    ...
    aerospikeConfig:
    service:
    feature-key-file: /etc/aerospike/secret/features.conf
    security: {}
    namespaces:
    - name: test
    replication-factor: 2
    storage-engine:
    type: memory
    files:
    - /opt/aerospike/data/test.dat
    filesize: 2000000000

    For the full CR file, see the example data-in-memory cluster CR with file persistence.

    This and other example CRs are available in the main Aerospike Kubernetes Operator repository.

  2. Save and exit the CR file, then use kubectl to apply the change.

    Terminal window
    kubectl apply -f aerospike-cluster.yaml