翻译或纠错本页面
延时节点¶
延时节点也将从 复制集 中主节点复制数据,然而延时节点中的数据集将会比复制集中主节点的数据延后。举个例子,现在是09:52,如果延时节点延后了1小时,那么延时节点的数据集中将不会有08:52之后的操作。
由于延时节点的数据集是延时的,因此它可以帮助我们在人为误操作或是其他意外情况下恢复数据。举个例子,当应用升级失败,或是误操作删除了表和数据库时,我们可以通过延时节点进行数据恢复。
注意事项¶
职责¶
延时节点:
- Must be priority 0 members. Set the priority to 0 to prevent a delayed member from becoming primary.
- Should be hidden members. Always prevent applications from seeing and querying delayed members.
- do vote in elections for primary, if members[n].votes is set to 1.
例子¶
In the following 5-member replica set, the primary and all secondaries have copies of the data set. One member applies operations with a delay of 3600 seconds (one hour). This delayed member is also hidden and is a priority 0 member.
配置方式¶
A delayed member has its members[n].priority equal to 0, members[n].hidden equal to true, and its members[n].slaveDelay equal to the number of seconds of delay:
{
"_id" : <num>,
"host" : <hostname:port>,
"priority" : 0,
"slaveDelay" : <seconds>,
"hidden" : true
}
参见 配置一个延时复制节点 获得更多有关延时节点配置的信息。