Can storage engine device and memory be used together?

Hi all, can someone please let me know if storage engine memory and device be used together like the following

namespace zp {
replication-factor 1
memory-size 1G
high-water-memory-pct 90
default-ttl 300
storage-engine memory
storage-engine device {
file /data/aerospike/zp.data
filesize 10G
}
}

Hi @deepak91

You could store data both in-memory and on-disk by using the data-in-memory directive.

Example:

namespace yourNamespaceName {
  memory-size 4G

  storage-engine device {
    file /opt/aerospike/<filename>
    filesize <SIZE>G
    data-in-memory true  # Indicates that all data should also be in memory.
  }
}

More info: http://www.aerospike.com/docs/operations/configure/namespace/storage/

Hi, thank you for your kind reply. Can you please let me know if the configuration I provided is correct and won’t throw any errors.

Thank You :smile:

I don’t think it is. The configuration reference specifies when a directive can be used multiple times. This is not the case with storage-engine.

Configuration reference doc: http://www.aerospike.com/docs/reference/configuration/#storage-engine

I just tried a config with two storage-engine directives in a single namespace, and it seems to completely ignore the first one. I didn’t spot an error, but when inspecting the configuration using asadm it displayed that the device is used as storage engine and data-in-memory is false.

Why would you need both engines at the same time? Is the data-in-memory setting not what you want?

Your configuration would be invalid. When Aerospike loads, it will use the storage engine you defined last.