Aerospike configuration meaning

I have following configuration. Is all data stored in file? After I loaded data I saw that 4G space was taken out of 5 but it decreased to 400MB after some time.

namespace test {
        replication-factor 2
        memory-size 5G
        default-ttl 0 # 30 days, use 0 to never expire/evict.

        storage-engine memory

        # To use file storage backing, comment out the line above and use the
        # following lines instead.
        storage-engine device {
                file /aerospike/data/foo.dat
                filesize 10G
                data-in-memory false # Store data in memory in addition to file.
        }
}

The primary index is kept in RAM and uses 64 bytes per record.

Nice. Data would be in disk and index in memory. Why during restart did all data got stored in memory?

You have defined two storage engines - first you have defined data storage to be in RAM, (storage-engine memory) and then once again storage-engine device. I am surprised Aerospike accepted it and actually started! - this is invalid configuration. Pick one.

Either storage-engine memory OR storage-engine device. If you pick device, then you can optionally choose to keep data in memory also by setting data-in-memory to true in the device config sub-stanza.

If I restart the cluster removing disk or memory then will the data be still there?

where will the data get loaded from for single node cluster?