无法删除来自aerospike的记录

时间:2016-11-01 08:46:13

标签: node.js 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);
});

这是我的conf:

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.
    }
}

如何完全删除记录?

1 个答案:

答案 0 :(得分:2)

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

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

Aerospike Enterprise Edition中提供的2个功能可解决此问题:

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

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