在数据同步过程中,客户担心在源端误操作,比如truncate, drop, delete all等,在目标端也会立即同步,而无法挽救损失;因此,客户希望是目标端的数据比源端要慢一个时间点。
解决方案:在ogg的replicat参数中使用
DEFERAPPLYINTERVAL <n><unit>
Specifies a length of time for Replicat to wait before applying replicated operations to the target database.
参数说明:
<n> A numeric value for the amount of time to delay. The minimum delay time is the value that is set for the EOFDELAY parameter. The maximum delay time is seven days.
<unit> The unit of time for the delay. Can be: S | SEC | SECS | SECOND | SECONDS | MIN | MINS | MINUTE | MINUTES | HOUR | HOURS | DAY | DAYS
<unit> The unit of time for the delay. Can be: S | SEC | SECS | SECOND | SECONDS | MIN | MINS | MINUTE | MINUTES | HOUR | HOURS | DAY | DAYS
使用这个参数之后,目标端始终与源端有一个时间差,但是源端的数据(队列文件)其实已经投递到目标端,只是没有交付到数据库。所以,如果源端当掉,目标端在去掉这个参数之后,可以很快追平数据,再去接管业务应用。