replSet error RS102 too stale to catch up

本文涉及的产品
云数据库 MongoDB,独享型 2核8GB
推荐场景:
构建全方位客户视图
简介:

辅助副本成员需要关机增加内存,很早就提前关机,等第二天服务器起来后,去查看rs.status()信息,会捕获到"stateStr" : "RECOVERING"。其实早已超过了维护窗口时间。这时,如果运气好的话,会看到error RS102 too stale to catch up错误。而该错误是每十分钟会捕获到一次。从mongodb的日志文件可以看到:

 

1
2
3
4
5
6
7
8
Thu Mar 26 20:50:48.561 [rsBackgroundSync] replSet error RS102 too stale to catch up, at least from dal05mgo13.sl.dx:27017
Thu Mar 26 20:50:48.561 [rsBackgroundSync] replSet error RS102 too stale to catch up
Thu Mar 26 21:00:49.632 [rsBackgroundSync] replSet error RS102 too stale to catch up, at least from dal05mgo13.sl.dx:27017
Thu Mar 26 21:00:49.632 [rsBackgroundSync] replSet error RS102 too stale to catch up
Thu Mar 26 21:10:50.701 [rsBackgroundSync] replSet error RS102 too stale to catch up, at least from dal05mgo12.sl.dx:27017
Thu Mar 26 21:10:50.701 [rsBackgroundSync] replSet error RS102 too stale to catch up
Thu Mar 26 21:20:51.770 [rsBackgroundSync] replSet error RS102 too stale to catch up, at least from dal05mgo13.sl.dx:27017
Thu Mar 26 21:20:51.770 [rsBackgroundSync] replSet error RS102 too stale to catch up

 

确认维护窗口大小



查看主副本的维护窗口和oplog大小:

 

1
2
3
4
5
6
rs_main: PRIMARY > db.printReplicationInfo()
configured oplog  size : 23552MB
log length start  to  end : 38133secs (10.59hrs)
oplog  first  event  time : Mon Mar 30 2015 12:00:13 GMT-0500 (CDT)
oplog  last  event  time : Mon Mar 30 2015 22:35:46 GMT-0500 (CDT)
now: Mon Mar 30 2015 22:35:46 GMT-0500 (CDT)

 

可以看到维护窗口为10个小时,oplog大小为23G。

辅助副本的维护窗口大小最好跟主副本成员保持一致,让辅助副本能保存从主副本同步过来的oplog。

 

如何重建oplog



以standalone方式启动,执行如下删除和创建脚本:

 

1
2
3
4
5
> use  local
> db.oplog.rs. drop ()
> db.createCollection( "oplog.rs" , { "capped"  true "size"  : 23 * 1024 * 1024 * 1024})
> db.runCommand( {  create "oplog.rs" , capped:  true size : (23 * 1024 * 1024 * 1024) } )

 

replSet error RS102 too stale to catch up如何处理?



副本集错误RS102太陈旧而无法跟上。说明此节点由于脱离副本集时间太长,已经跟不上整个集群了。需要重新同步该辅助副本成员。可参考:

http://docs.mongodb.org/manual/tutorial/resync-replica-set-member/

官方手册建议,通过移除数据实施初始化同步(initial sync)来完全重新同步成员。

 

MongoDB提供了两种实施初始化同步的方法:

  • 清空数据目录,重启mongod。让MongoDB的正常初始化同步数据恢复数据。这个方法更简单,但是需要花更多的时间替换数据。

  • 从副本集中的另一个成员拷贝当前的数据目录,重启机器。这个过程替换数据更快,但是需要更多手工步骤。















本文转自UltraSQL51CTO博客,原文链接: http://blog.51cto.com/ultrasql/1626753,如需转载请自行联系原作者

相关实践学习
MongoDB数据库入门
MongoDB数据库入门实验。
快速掌握 MongoDB 数据库
本课程主要讲解MongoDB数据库的基本知识,包括MongoDB数据库的安装、配置、服务的启动、数据的CRUD操作函数使用、MongoDB索引的使用(唯一索引、地理索引、过期索引、全文索引等)、MapReduce操作实现、用户管理、Java对MongoDB的操作支持(基于2.x驱动与3.x驱动的完全讲解)。 通过学习此课程,读者将具备MongoDB数据库的开发能力,并且能够使用MongoDB进行项目开发。   相关的阿里云产品:云数据库 MongoDB版 云数据库MongoDB版支持ReplicaSet和Sharding两种部署架构,具备安全审计,时间点备份等多项企业能力。在互联网、物联网、游戏、金融等领域被广泛采用。 云数据库MongoDB版(ApsaraDB for MongoDB)完全兼容MongoDB协议,基于飞天分布式系统和高可靠存储引擎,提供多节点高可用架构、弹性扩容、容灾、备份回滚、性能优化等解决方案。 产品详情: https://www.aliyun.com/product/mongodb
相关文章
|
11月前
|
Web App开发 前端开发
【前端异常】Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
【前端异常】Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
636 0
|
3月前
|
JSON 数据格式
【ERROR】Error: transaction invalidated with status (ENDORSEMENT_POLICY_FAILURE)
【ERROR】Error: transaction invalidated with status (ENDORSEMENT_POLICY_FAILURE)
33 0
|
4月前
|
druid Java
Error attempting to get column ‘createTime‘ from result set的异常
Error attempting to get column ‘createTime‘ from result set的异常
300 0
|
存储 前端开发 Java
Exception 和 Error
Exception 和 Error
81 0
schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326)
schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326)
359 0
schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326)
|
索引
ES报错:“type“=>“cluster_block_exception“, “reason“=>“blocked by: [FORBIDDEN/12/index read-only / allow
ES报错:“type“=>“cluster_block_exception“, “reason“=>“blocked by: [FORBIDDEN/12/index read-only / allow
326 0
ES报错:“type“=>“cluster_block_exception“, “reason“=>“blocked by: [FORBIDDEN/12/index read-only / allow
|
SQL 关系型数据库 数据库
[Err] ERROR: invalid input syntax for integer: "1.0"
[Err] ERROR: invalid input syntax for integer: "1.0"
1043 0
[Err] ERROR: invalid input syntax for integer: "1.0"
|
缓存 Java
try-catch能捕获Out Of Memory Error吗?
现已知代码A可能诱发OOM。代码B可替代代码A但可维护性差。我希望能先尝试执行代码A,如果发生OOM,则退回来执行代码B。 那么如下代码可行吗?
461 0
|
Java Shell Linux
[ERROR] Result: { execute timeout }异常解决
记一次AlibabaCloudToolKit插件使用过程中云助手执行脚本时,脚本超时的异常的解决方案.
10539 0