2013-08-16 105 views
2

我們的mongodb服務器部署有2個分片,每個分片有1個主服務器和2個從服務器。 四臺從服務器運行mongo config作爲代理,兩臺從服務器運行仲裁器。 但是現在mongodb coundn't。MongoDB分片問題

我可以連接到192.168.0.1:8000(mongos)和exec查詢,如'use database'或'show dbs',但是我不能在選擇的數據庫中執行查詢,如'db.foo.count( )」, 'db.foo.findOne()'

以下是錯誤日誌:

mongos> db.dev.count() 
Fri Aug 16 12:55:36 uncaught exception: count failed: { 
    "assertion" : "DBClientBase::findN: transport error: 10.81.4.72:7100 query: { setShardVersion: \"\", init: true, configdb: \"10.81.4.72:7300,10.42.50.26:7300,10.81.51.235:7300\", serverID: ObjectId('520db0a51fa00999772612b9'), authoritative: true }", 
    "assertionCode" : 10276, 
    "errmsg" : "db assertion failure", 
    "ok" : 0 
} 




Fri Aug 16 11:23:29 [conn8431] DBClientCursor::init call() failed 
Fri Aug 16 11:23:29 [conn8430] Socket recv() errno:104 Connection reset by peer 10.81.4.72:7100 
Fri Aug 16 11:23:29 [conn8430] SocketException: remote: 10.81.4.72:7100 error: 9001 socket exception [1] server [10.81.4.72:7100] 
Fri Aug 16 11:23:29 [conn8430] DBClientCursor::init call() failed 
Fri Aug 16 11:23:29 [conn8430] DBException in process: could not initialize cursor across all shards because : DBClientBase::findN: transport error: 10.81.4.72:7100 query: { setShardVersion: "", init: true, configdb: "10.81.4.72:7300,10.42.50.26:7300,10.81.51.235:7300", serverID: ObjectId('520d99c972581e6a124d0561'), authoritative: true } @ s01/10.36.31.36:7100,10.42.50.24:7100,10.81.4.72:7100 

我只能在mongos開始,查詢不會EXEC如果超過1個mongos在運行同時錯誤日誌:

mongos> db.dev.count() Fri Aug 16 15:12:29 uncaught exception: count failed: { "assertion" : "DBClientBase::findN: transport error: 10.81.4.72:7100 query: { setShardVersion: \"\", init: true, configdb: \"10.81.4.72:7300,10.42.50.26:7300,10.81.51.235:7300\", serverID: ObjectId('520dd04967557902f73a9fba'), authoritative: true }", "assertionCode" : 10276, "errmsg" : "db assertion failure", "ok" : 0 } 
+0

沒有之前的工作?你有沒有改變配置中的任何東西?你是如何設置副本集的? – Tilo

+0

從運行mongos的服務器,你可以嘗試直接通過mongo shell作爲第一個測試來連接到每個mongods(config和master)嗎?另外,爲什麼您使用主/從配置超過副本集? –

+0

我只能在mongos上啓動,如果超過1個mongos同時運行,查詢將不會執行,錯誤日誌:mongos> db.dev.count() Fri Aug 16 15:12:29未捕獲的異常:count失敗:{ \t「assertion」:「DBClientBase :: findN:transport error:10.81.4.72:7100 query:{setShardVersion:\」\「,init:true,configdb:\」10.81.4.72:7300,10.42.50.26 :7300,10.81.51.235:7300 \ 「SERVERID:物件( '520dd04967557902f73a9fba'),權威:真正}」, \t 「assertionCode」:10276, \t 「ERRMSG」: 「DB斷言失敗」, \t「OK 「:0 } –

回答

0

Coul如果你現在正在設置它,你是否應該澄清一下你的設置是否在工作?

若要修復MongoDB的,你可能想請點擊此鏈接:(!) http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/

參考

MongoDB Documentation : Deploying a Shard-Cluster

MongoDB Documentation : Add Shards to an existing cluster

舊的,過時的信息:

YouTube Video on Setting-up Sharding for MongoDB

Corresponding Blog on blog.serverdensity.com

+0

它以前運行良好,因爲服務器崩潰並重新啓動 –

+1

@feiyan你檢查了腐敗嗎? – Sammaye