---
title: "利用dbHash恢复不一致的mongodb config server"
author: "kabike"
date: "2016-07-14T20:03:01Z"
tags: []
categories: ["开源软件"]
slug: "dbhash-mongodb-config-server"
draft: false
lastmod: "2016-07-14T20:03:01Z"
id: 2311319
url: "https://kabike.iteye.com/blog/2311319"
---

原来mongodb的文档上一直宣称是2阶段协议提交来保证3个config server保持强一致性,然而其实不是的
<https://jira.mongodb.org/browse/DOCS-5289>
有人看源代码,发现mongodb源码和文档不一致,提交了这个jira,导致mongodb连官方文档都改了...噗...

由于各种原因导致config server不一致的时候,mongos日志中出现了
will not perform auto-split because config servers are inconsistent
可以用[dbHash](https://docs.mongodb.com/manual/reference/command/dbHash/)来比较3个config server,找到不一致的那个,用其他的两个来恢复它