故障现象
mongodb重启后,等了几十分钟还一直没启动完成,单节点副本集,状态一直处于startup
原因分析
查看mongod的错误日志,发现一直处于building index,但根据之前的经验,只有在重做secondary节点的时候才会经常处于building index状态,而这个db是primary节点,于是详细查看了关于这个building index的全部信息
2017-01-05T17:24:59.473+0800 [IndexRebuilder] found 1 index(es) that wasn't finished before shutdown
2017-01-05T17:24:59.473+0800 [IndexRebuilder] found 1 interrupted index build(s) on aso.app_version_info_chn1
2017-01-05T17:24:59.473+0800 [IndexRebuilder] note: restart the server with --noIndexBuildRetry to skip index rebuilds
2017-01-05T17:24:59.473+0800 [IndexRebuilder] going to rebuild: { v: 1, unique: true, key: { _fts: "text", _ftsx: 1 }, name: "$**_text", ns: "aso.app_version_info_chn1", weights: { $**: 1 }, default_language: "english", language_override: "language", textIndexVersion: 2 }
2017-01-05T17:24:59.474+0800 [IndexRebuilder] build index on: aso.app_version_info_chn1 properties: { v: 1, unique: true, key: { _fts: "text", _ftsx: 1 }, name: "$**_text", ns: "aso.app_version_info_chn1", weights: { $**: 1 }, default_language: "english", language_override: "language", textIndexVersion: 2 }
2017-01-05T17:24:59.474+0800 [IndexRebuilder] building index using bulk method
根据错误日志的提示信息,看样子原因是这样的:在db关闭之前,有一二较大的索引建立的操作没有完成,db就直接shutdown了,等db再次启动的时候,mongo默认会将这个index重建好,重建期间处于startup状态
处理方法
由于不清楚building index到底要持续多久,根据错误日志提示,重启mongod时加上--noIndexBuildRetry参数来跳过索引重建。等启动完成后,再评估是否需要建立这个index。
---------------------
作者:胡儿胡儿
来源:CSDN
原文:https://blog.csdn.net/cug_jiang126com/article/details/54097365
版权声明:本文为博主原创文章,转载请附上博文链接!