无法从 aerospike 中删除记录

Can't remove record from aerospike

我决定尝试 aerospike,但我遇到了一些问题。 我在 docker:

中使用 aerospike
companies-data:
    image: 'aerospike/aerospike-server:3.10.0-1'
    ports:
        - '5310:3000'
        - '5311:3001'
        - '5312:3002'
        - '5313:3003'
    volumes:
        - './companies-data/data:/opt/aerospike/data'
        - './companies-data/config:/opt/aerospike/etc'
    command: '/usr/bin/asd --foreground --config-file /opt/aerospike/etc/aerospike.conf'

当我创建记录然后重新启动 docker 容器时,数据仍然存在,因此卷设置正确。但是,当我删除一条记录并重新启动 docker 容器时,该记录仍然存在,它没有被删除。在重新启动之前它工作正常:记录被删除但是在 docker-container 重新启动之后它又在那里了。

我正在使用 nodejs aerospike 客户端。

let key = new Key(this.ns, this.set, id);
client.remove(key, function (err, key) {
    if (err) {
        return reject(err);
    }
    resolve(key);
});

这是我的配置文件:

service {
    user root
    group root
    paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
    pidfile /var/run/aerospike/asd.pid
    service-threads 4
    transaction-queues 4
    transaction-threads-per-queue 4
    proto-fd-max 15000
}

logging {

    # Log file must be an absolute path.
    file /var/log/aerospike/aerospike.log {
        context any info
    }

    # Send log messages to stdout
    console {
        context any info
    }
}

network {
    service {
        address any
        port 3000

        # Uncomment the following to set the `access-address` parameter to the
        # IP address of the Docker host. This will the allow the server to correctly
        # publish the address which applications and other nodes in the cluster to
        # use when addressing this node.
        # access-address <IPADDR>
    }

    heartbeat {

        # mesh is used for environments that do not support multicast
        mode mesh
        port 3002

        # use asinfo -v 'tip:host=<ADDR>;port=3002' to inform cluster of
        # other mesh nodes

        interval 150
        timeout 10
    }

    fabric {
        port 3001
    }

    info {
        port 3003
    }
}

namespace mtm {
    replication-factor 2
    memory-size 1G
    default-ttl 5d # 5 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 /opt/aerospike/data/mtm.dat
        filesize 4G
        data-in-memory true # Store data in memory in addition to file.
    }
}

如何彻底删除一条记录?

删除机制删除数据的索引条目,从而立即释放索引space和存储空间space。但是,它不会持久地将逻辑删除标记记录写入存储,因此可以通过集群完全冷重启或网络分区场景来恢复已删除的记录。

这是来自关于 3.10 版本的最新 Aerospike Blog Post

Aerospike 企业版中的 2 项功能确实解决了此问题:

1- 快速启动(索引保存在共享内存中)。 2- 持久删除(参见上面提到的博客 post)。

您可以在 Aerospike 论坛上阅读有关您在 this thread 上遇到的行为的更多信息。