Aerospike的一致性问题

时间:2015-11-24 13:05:22

标签: consistency aerospike

我在Aerospike(v3.5.12)中用作一个节点的内存键值存储。

还使用Java客户端(v3.1.7)来检索和写入数据。

我注意到在某些QPS(3K)读取(批处理)和写入。

有些数据检索无效。

[INFO] [24/11/2015 14:43:38.782] Write Data
[ERROR] [24/11/2015 14:43:38.937] Read Data - Not Found

有人遇到类似问题吗?

更新

我更新了Aerospike 3.7.1。

我在以下问题中使用异步操作:

    public void store() {
        WritePolicy expirationWritePolicy = new WritePolicy();
        expirationWritePolicy.sendKey = true;
        expirationWritePolicy.priority = Priority.HIGH;
        expirationWritePolicy.expiration = 10;

        Key key = new Key(namespace, SET_NAME, requestId);
        Bin bin = new Bin(BIN_NAME, serializer.toBinary(budgetCommit));
        Bin extra = new Bin("extra", "data");

        client.put(expirationWritePolicy, new WriteListener() {
            @Override
            public void onSuccess(Key key) {
                logger.info("Succeed to store {}", requestId());
            }

            @Override
            public void onFailure(AerospikeException exception) {
                logger.error(exception, "Fail to store {}", key);
            }
        }, key, extra, bin);
    }

  public void retrieve() {
        WritePolicy defaultWritePolicy = new WritePolicy();
        defaultWritePolicy.priority = Priority.LOW;
        defaultWritePolicy.sendKey = true;

        Key key = new Key(namespace, SET_NAME, requestId);
        Bin closeExtra = new Bin("extra", "_closed");

        client.operate(defaultWritePolicy, new RecordListener() {
                    @Override
                    public void onSuccess(Key key, Record record) {
                        if (record.getValue(BIN_NAME) == null){
                               logger.error("Fail to retrieve {}", requestId);
                         }
                    }

                    @Override
                    public void onFailure(AerospikeException exception) {
                        logger.error("Fail to retrieve {} : {}", requestId, exception.getMessage());
                    }
                }, key,
                Operation.append(closeExtra), Operation.get());
    }

[INFO] [12/01/2016 08:37:16.732]成功储存379e67dc-945d-4717-97a7-721cc8093c05 [ERROR] [12/01/2016 08:37:16.736]无法检索379e67dc-945d-4717-97a7-721cc8093c05

当Aerospike有Ack时,会调用onSuccess回调。

在主写入时开始失败大约8k QPS。

1 个答案:

答案 0 :(得分:3)

可能会发生重新平衡轮次。批处理进入该版本不会代理到其他节点。

Aerospike Server 3.6.4有一个可以代理的新批处理实现。

http://www.aerospike.com/download/server/notes.html#3.6.4