1.4. 自动执行备份离线
您可以将备份位置配置为在远程站点不可用时自动离线。这可防止 Data Grid 节点不断尝试将数据复制到离线备份位置,这会导致错误消息和消耗资源。
备份操作的超时时间
备份配置包括用于复制数据的操作的超时值。如果在超时前操作没有完成,则数据网格会将其记录为失败。
<!-- Operations to replicate data to NYC are recorded as failures if they do not complete after 10 seconds. --> <backup site="NYC" strategy="ASYNC" timeout="10000"> <!-- Configuration for backup locations goes here. --> </backup>
<!-- Operations to replicate data to NYC are recorded as failures if they do not complete after 10 seconds. -->
<backup site="NYC" strategy="ASYNC" timeout="10000">
<!-- Configuration for backup locations goes here. -->
</backup>
失败数
您可以指定备份位置离线前可能出现的 连续 失败数量。
例如,NYC 的以下配置会在离线前将五个操作设置为失败的操作数量:
<!-- If a cluster attempts to replicate data to NYC and five consecutive operations fail, NYC automatically goes offline. --> <backup site="NYC" strategy="ASYNC" timeout="10000"> <take-offline after-failures="5"/> </backup>
<!-- If a cluster attempts to replicate data to NYC and five consecutive operations fail, NYC automatically goes offline. -->
<backup site="NYC" strategy="ASYNC" timeout="10000">
<take-offline after-failures="5"/>
</backup>
等待时间
您还可以指定在备份操作失败时进行站点离线前等待的时间。如果在等待时间超时前备份请求成功,则数据网格不会使站点离线。
<!-- If a cluster attempts to replicate data to NYC and there are more than five consecutive failures and 15 seconds elapse after the first failed operation, NYC automatically goes offline. -->
<backup site="NYC" strategy="ASYNC" timeout="10000">
<take-offline after-failures="5"
min-wait="15000"/>
</backup>
<!-- If a cluster attempts to replicate data to NYC and there are more than five consecutive failures and 15 seconds elapse after the first failed operation, NYC automatically goes offline. -->
<backup site="NYC" strategy="ASYNC" timeout="10000">
<take-offline after-failures="5"
min-wait="15000"/>
</backup>
提示
如果要只使用最小时间等待站点离线,请为 after-failures 属性设置负或零值。
<take-offline after-failures="-1" min-wait="10000"/>
<take-offline after-failures="-1" min-wait="10000"/>