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
相关文章
ES集群报错 failed to send join request to maste
ES集群报错 failed to send join request to maste
312 0
|
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.
1059 0
|
11月前
|
druid Java
Error attempting to get column ‘createTime‘ from result set的异常
Error attempting to get column ‘createTime‘ from result set的异常
555 0
|
11月前
|
应用服务中间件 nginx Windows
[emerg] 15060#200: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket ......
[emerg] 15060#200: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket ......
279 0
|
数据安全/隐私保护
Do Sync Disk 0 Part 0 Failed, code=S3_F42, msg=Sync Failed after retry 5 times
Do Sync Disk 0 Part 0 Failed, code=S3_F42, msg=Sync Failed after retry 5 times
216 1
|
关系型数据库 MySQL C++
Error:fatal error C1010: unexpected end of file while looking for precompiled head
Error:fatal error C1010: unexpected end of file while looking for precompiled head
146 0
|
网络协议 Oracle MySQL
从源码解析ERROR 1129 (HY000):Host is blocked because of many connection errors
原创水平有限,有错请指出 源码版本5.7.14 今天群里一个朋友出现如下错误: ERROR 1129 (HY000): Host '10.0.0.8' is blocked because of many connection errors; unblock w...
2585 0
unknown type name err_status_t; did you mean srtp_err_status_t/err_status_ok/err_status_replay_fail
unknown type name err_status_t; did you mean srtp_err_status_t/err_status_ok/err_status_replay_fail
190 0
没解决:RuntimeWarning: tp_compare didn't return -1 or -2 for exception
没解决:RuntimeWarning: tp_compare didn't return -1 or -2 for exception
126 0