AeroSpike 在我的记录中创建了 TTL
AeroSpike created TTL in my records
我很难理解 AeroSpike 文档中的以下内容:
http://www.aerospike.com/docs/client/python/usage/kvs/record-structure.html
A record also has two metadata values associated with it - the record generation (the number of times it has been modified) and its ttl. A ttl can be set to the numbers of second remaining till it is considered expired, or to 0 (for 'never expire', and the default). Records whose ttl has expired will be garbage collected by the server. Each time the record is written or touched (using touch()) its ttl will reset.
我最初的想法是,如果命名空间策略默认 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;
The node.js get operations meta information is displaying { ttl: 4294967295, gen: 2 }.
好的!所以 TTL 无符号 32 位整数,如果它是有符号的,您将看到 (2^32 -1) 的最大值,它将是 -1。最大值在 Aerospike 中有特殊意义,它意味着它无限期地存在。 Aerospike 已经接受 -1 为无限期大约一年了,客户端的 0 意味着使用服务器默认值。
node.js 客户端基于我们的 c 客户端,它被更改为将来自服务器的 ttl 0 值转换为 0xFFFFffff 或 -1。 c client's 3.0.51 release notes.
中提到了这一点
感谢您强调这个问题,看起来这个区域有一些过时的文档。
我很难理解 AeroSpike 文档中的以下内容:
http://www.aerospike.com/docs/client/python/usage/kvs/record-structure.html
A record also has two metadata values associated with it - the record generation (the number of times it has been modified) and its ttl. A ttl can be set to the numbers of second remaining till it is considered expired, or to 0 (for 'never expire', and the default). Records whose ttl has expired will be garbage collected by the server. Each time the record is written or touched (using touch()) its ttl will reset.
我最初的想法是,如果命名空间策略默认 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;
The node.js get operations meta information is displaying { ttl: 4294967295, gen: 2 }.
好的!所以 TTL 无符号 32 位整数,如果它是有符号的,您将看到 (2^32 -1) 的最大值,它将是 -1。最大值在 Aerospike 中有特殊意义,它意味着它无限期地存在。 Aerospike 已经接受 -1 为无限期大约一年了,客户端的 0 意味着使用服务器默认值。
node.js 客户端基于我们的 c 客户端,它被更改为将来自服务器的 ttl 0 值转换为 0xFFFFffff 或 -1。 c client's 3.0.51 release notes.
中提到了这一点感谢您强调这个问题,看起来这个区域有一些过时的文档。