我很难从AeroSpike文档中了解以下内容:
http://www.aerospike.com/docs/client/python/usage/kvs/record-structure.html
记录还有两个与之关联的元数据值 - 记录生成(修改的次数)及其ttl . 可以将ttl设置为剩余的第二个数,直到它被认为已过期,或者设置为0(对于“永不过期”和默认值) . ttl已过期的记录将由服务器进行垃圾收集 . 每次写入或触摸记录时(使用touch()),其ttl将重置 .
我最初的想法是,如果命名空间策略默认ttl设置为0,那么记录将不会过期 .
我的Aerospike命名空间配置如下:
namespace brand {
replication-factor 2
memory-size 4G
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.
set twitter {
set-disable-eviction true
}
storage-engine device {
file /opt/aerospike/data/bar.dat
filesize 16G
data-in-memory true # Store data in memory in addition to file.
}
}
我在数据库中做了一些插入,然后当我检索数据时,我得到了以下内容:
{ name: 'test',
twitter: 'test',
domain: 'test.com',
description: 'Your First Round Fund' } { ttl: 4294967295, gen: 2 }
不知何故,ttl出现在唱片上,而其他唱片也有ttl . 我不希望从数据库中删除我的记录 . 如何从记录中删除ttl以及如何防止将来发生这种情况?
"asadm -e 'show stat like ttl'
显示以下内容:
~~~~brand Namespace Statistics~~~~
NODE : 1
cold-start-evict-ttl: 4294967295
default-ttl : 0
max-ttl : 0
~~~~test Namespace Statistics~~~~~
NODE : 1
cold-start-evict-ttl: 4294967295
default-ttl : 2592000
max-ttl : 0
asinfo -v 'hist-dump:ns=brand;hist=ttl'
显示以下内容
brand:ttl=100,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
1 回答
好的!所以TTL无符号32位整数,你看到的最大值为(2 ^ 32 -1),如果它是一个有符号的,它将是-1 . 最大值在Aerospike中具有特殊意义,它意味着它无限期地存在 . Aerospike已经接受-1为无限期约一年,而来自客户端的0表示使用服务器默认值 .
node.js客户端基于我们的c客户端,该客户端已更改为将服务器的ttl 0值转换为0xFFFFffff或-1 . _1745282中提到了这一点 .
感谢您突出显示此问题,看起来这个区域有一些陈旧的文档 .