MongoDB setShardVersion 失败,仅 mongodump

发布于 2024-11-01 01:32:28 字数 8801 浏览 0 评论 0原文

我正在使用分片(通过副本集)并尝试转储数据库。 通过 key files_id 为 mycms-prod.fs.chunks 启用分片。 其他信息:http://groups.google.com/group/mongodb-用户/browse_thread/thread/a8f05cbf495d6487 我已阅读此说明: http://www.mongodb.org/display /DOCS/备份+向上+分片+集群 (对于小集群)。

$ /opt/mongodb/bin/mongodump -h localhost:30000 -d mycms-prod 
.... 
Other collections that are not currently in sharding dumps ok. 
       mycms-prod.tracking_daystat to dump/mycms-prod/ 
tracking_daystat.bson 
                370 objects 
.... 
       mycms-prod.fs.chunks to dump/mycms-prod/fs.chunks.bson 
assertion: 11010 count fails:{ assertion: "setShardVersion failed 
host[server1.domain.com:28000] { errmsg: "not master...", 
assertionCode: 10429, errmsg: "db assertion failure", ok: 0 } 

在 mongos.log 中:

######################### 
Tue Apr 12 01:20:14 [mongosMain] connection accepted from 
127.0.0.1:42975 #27 
Tue Apr 12 01:20:15 [conn27]      setShardVersion failed 
host[server1.domain.com:28000] { errmsg: "not master", ok: 0.0 } 
Tue Apr 12 01:20:15 [conn27] Assertion: 10429:setShardVersion failed 
host[server1.domain.com:28000] { errmsg: "not master", ok: 0.0 } 
0x51f4a9 0x69b163 0x69acf2 0x69acf2 0x69acf2 0x576ba6 0x5774b6 
0x575630 0x575b31 0x65f661 0x57bdcc 0x631062 0x66432c 0x6761c7 
0x57ea3c 0x69ec30 0x3a9be0673d 0x3a9b6d40cd 
 /opt/mongodb/bin/mongos(_ZN5mongo11msgassertedEiPKc+0x129) [0x51f4a9] 
 /opt/mongodb/bin/mongos [0x69b163] 
 /opt/mongodb/bin/mongos [0x69acf2] 
 /opt/mongodb/bin/mongos [0x69acf2] 
 /opt/mongodb/bin/mongos [0x69acf2] 
 /opt/mongodb/bin/ 
mongos(_ZN5boost6detail8function17function_invoker4IPFbRN5mongo12DBClientBa seERKSsbiEbS5_S7_biE6invokeERNS1_15function_bufferES5_S7_bi 
+0x16) [0x576ba6] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo17ClientConnections13checkVersionsERKSs+0x1c6) 
[0x5774b6] 
 /opt/mongodb/bin/mongos(_ZN5mongo15ShardConnection5_initEv+0x2d0) 
[0x575630] 
 /opt/mongodb/bin/mongos(_ZN5mongo15ShardConnectionC1ERKNS_5ShardERKSs 
+0xa1) [0x575b31] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo15dbgrid_pub_cmds8CountCmd3runERKSsRNS_7BSONObjERSsRNS_14BS ONObjBuilderEb 
+0x9e1) [0x65f661] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo7Command20runAgainstRegisteredEPKcRNS_7BSONObjERNS_14BSONOb jBuilderE 
+0x67c) [0x57bdcc] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo14SingleStrategy7queryOpERNS_7RequestE+0x262) 
[0x631062] 
 /opt/mongodb/bin/mongos(_ZN5mongo7Request7processEi+0x29c) [0x66432c] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21Abstract MessagingPortEPNS_9LastErrorE 
+0x77) [0x6761c7] 
 /opt/mongodb/bin/mongos(_ZN5mongo3pms9threadRunEPNS_13MessagingPortE 
+0x34c) [0x57ea3c] 
 /opt/mongodb/bin/mongos(thread_proxy+0x80) [0x69ec30] 
 /lib64/libpthread.so.0 [0x3a9be0673d] 
 /lib64/libc.so.6(clone+0x6d) [0x3a9b6d40cd] 
Tue Apr 12 01:20:15 [conn27] end connection 127.0.0.1:42975 
######################### 

然后我将转到 server1.domain.com。

[moskrc@server9 db]$ /opt/mongodb/bin/mongo server1.domain.com:28000 
MongoDB shell version: 1.8.1 
connecting to: server1.domain.com:28000/test 
rs1:SECONDARY> use mycms-prod 
switched to db mycms-prod 
rs1:SECONDARY> db.fs.chunks.count() 
Tue Apr 12 01:22:23 uncaught exception: count failed: { "errmsg" : 
"not master", "ok" : 0 } 
rs1:SECONDARY> 

我认为 mongos 不应该联系这台计算机。自从它 是副本集的辅助。

这是一个错误吗?

版本 1.8.1 的所有组件。

有一个细微差别。该数据库在以下命令的帮助下恢复 蒙戈雷商店。

我认为转储可能出了问题。我刚刚创建了一个新的 数据库 shard-test,复制 500 个文件(在 gridfs 中)并 激活分片。

等待所有数据分布到服务器上。并试图做一个 转储数据库。令人惊讶的是,它成功了!来自不同的mongos 也有效。这意味着什么?

This is console output: 
        { "_id" : "shard-test", "partitioned" : true, "primary" : "rs2" } 
                shard-test.fs.chunks chunks: 
                                rs1     3 
                                rs3     3 
                                rs2     5 
                        { "files_id" : { $minKey : 1 } } -->> { "files_id" : 
ObjectId("4da48f64d8b9bb5239000000") } on : rs1 { "t" : 2000, "i" : 
0 } 
                        { "files_id" : ObjectId("4da48f64d8b9bb5239000000") } -->> 
{ "files_id" : ObjectId("4da49002d8b9bb527400005d") } on : rs3 { "t" : 
3000, "i" : 0 } 
                        { "files_id" : ObjectId("4da49002d8b9bb527400005d") } -->> 
{ "files_id" : ObjectId("4da49006d8b9bb5274000132") } on : rs1 { "t" : 
4000, "i" : 0 } 
                        { "files_id" : ObjectId("4da49006d8b9bb5274000132") } -->> 
{ "files_id" : ObjectId("4da49009d8b9bb527400028e") } on : rs3 { "t" : 
5000, "i" : 0 } 
                        { "files_id" : ObjectId("4da49009d8b9bb527400028e") } -->> 
{ "files_id" : ObjectId("4da4900ed8b9bb52740003d9") } on : rs1 { "t" : 
6000, "i" : 0 } 
                        { "files_id" : ObjectId("4da4900ed8b9bb52740003d9") } -->> 
{ "files_id" : ObjectId("4da4902ad8b9bb5274000530") } on : rs3 { "t" : 
7000, "i" : 0 } 
                        { "files_id" : ObjectId("4da4902ad8b9bb5274000530") } -->> 
{ "files_id" : ObjectId("4da49032d8b9bb52740005e1") } on : rs2 { "t" : 
7000, "i" : 1 } 
                        { "files_id" : ObjectId("4da49032d8b9bb52740005e1") } -->> 
{ "files_id" : ObjectId("4da49039d8b9bb5274000697") } on : rs2 { "t" : 
2000, "i" : 2 } 
                        { "files_id" : ObjectId("4da49039d8b9bb5274000697") } -->> 
{ "files_id" : ObjectId("4da4906ed8b9bb5274000749") } on : rs2 { "t" : 
3000, "i" : 2 } 
                        { "files_id" : ObjectId("4da4906ed8b9bb5274000749") } -->> 
{ "files_id" : ObjectId("4da490a1d8b9bb52be000007") } on : rs2 { "t" : 
7000, "i" : 2 } 
                        { "files_id" : ObjectId("4da490a1d8b9bb52be000007") } -->> 
{ "files_id" : { $maxKey : 1 } } on : rs2 { "t" : 7000, "i" : 3 } 
> bye 

(env)[moskrc@server2 tmp]$ /opt/mongodb/bin/mongodump -h localhost: 
30000 -d shard-test 
connected to: localhost:30000 
DATABASE: shard-test     to     dump/shard-test 
        shard-test.system.indexes to dump/shard-test/system.indexes.bson 
                 4 objects 
        shard-test.fs.chunks to dump/shard-test/fs.chunks.bson 
                600/1496        40% 
                700/1496        46% 
                900/1496        60% 
                1100/1496       73% 
                1400/1496       93% 
                 1496 objects 
        shard-test.fs.files to dump/shard-test/fs.files.bson 
                 804 objects 

注意到另一个细微差别。

如果我这样做:

[moskrc@server9 mycms-prod]$ /opt/mongodb/bin/mongodump -h localhost: 
30000 -d mycms-prod 
connected to: localhost:30000 
DATABASE: mycms-prod     to     dump/mycms-prod 
        mycms-prod.cms_comment to dump/mycms-prod/cms_comment.bson 
                 16 objects 
        mycms-prod.system.indexes to dump/mycms-prod/system.indexes.bson 
                 67 objects 
        mycms-prod.cms_pdfcontent to dump/mycms-prod/cms_pdfcontent.bson 
                 18 objects 
        mycms-prod.djangoratings_vote to dump/mycms-prod/ 
djangoratings_vote.bson 
                 25 objects 
        mycms-prod.auth_permission to dump/mycms-prod/auth_permission.bson 
                 192 objects 
        mycms-prod.tracking_pagevisit to dump/mycms-prod/ 
tracking_pagevisit.bson 
assertion: 11010 count fails:{ assertion: "setShardVersion failed 
host[server2.domain.com:28000] { errmsg: "not maste...", 
assertionCode: 10429, errmsg: "db assertion failure", ok: 0 } 

tracking_pagevisit 集合发生错误。

然后...让我们尝试单独转储这个集合。

[moskrc@server9 mycms-prod]$ /opt/mongodb/bin/mongodump -h localhost: 
30000 -d mycms-prod -c tracking_pagevisit 
connected to: localhost:30000 
DATABASE: mycms-prod     to     dump/mycms-prod 
        mycms-prod.tracking_pagevisit to dump/mycms-prod/ 
tracking_pagevisit.bson 
                 14158 objects 

这个工作出来了!!!发生什么事了?

我的系统:

CentOS 5.5 

Kernel: Linux server9.domain.com 2.6.18-194.el5xen #1 SMP Fri Apr 2 15:34:40 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux 

我有6个mongos。实际上始终只使用 2 个。对于 2 个应用程序。每个 应用程序有自己的mongos。

我总共有 9 台服务器。每次使用参数运行 mongod 时: shardsvr = true replSet = rs1(rs2 和 rs3)。三个复制品。每个副本 由3个mongod组成。以及三个配置服务器(server4.domain.com: 28001,server6.domain.com:28001,server1.domain.com:28001)。

蒙戈斯参数 bind_ip = 127.0.0.1,123.456.789.12 端口 = 30000 分叉 = true configdb = server4.domain.com:28001,server6.domain.com:28001,server1.domain.com: 28001

我重新启动了使用的mongos。这很有帮助。数据库现在是相同的。但 转储仍然无法正常工作。我写了上面的错误。

谢谢。

I am use sharding (over replica set) and try to dump the database.
Sharding enabled for mycms-prod.fs.chunks by key files_id.
Additional info: http://groups.google.com/group/mongodb-user/browse_thread/thread/a8f05cbf495d6487
I have readed this instruction: http://www.mongodb.org/display/DOCS/Backing+Up+Sharded+Cluster
(for Small clusters).

$ /opt/mongodb/bin/mongodump -h localhost:30000 -d mycms-prod 
.... 
Other collections that are not currently in sharding dumps ok. 
       mycms-prod.tracking_daystat to dump/mycms-prod/ 
tracking_daystat.bson 
                370 objects 
.... 
       mycms-prod.fs.chunks to dump/mycms-prod/fs.chunks.bson 
assertion: 11010 count fails:{ assertion: "setShardVersion failed 
host[server1.domain.com:28000] { errmsg: "not master...", 
assertionCode: 10429, errmsg: "db assertion failure", ok: 0 } 

And in mongos.log:

######################### 
Tue Apr 12 01:20:14 [mongosMain] connection accepted from 
127.0.0.1:42975 #27 
Tue Apr 12 01:20:15 [conn27]      setShardVersion failed 
host[server1.domain.com:28000] { errmsg: "not master", ok: 0.0 } 
Tue Apr 12 01:20:15 [conn27] Assertion: 10429:setShardVersion failed 
host[server1.domain.com:28000] { errmsg: "not master", ok: 0.0 } 
0x51f4a9 0x69b163 0x69acf2 0x69acf2 0x69acf2 0x576ba6 0x5774b6 
0x575630 0x575b31 0x65f661 0x57bdcc 0x631062 0x66432c 0x6761c7 
0x57ea3c 0x69ec30 0x3a9be0673d 0x3a9b6d40cd 
 /opt/mongodb/bin/mongos(_ZN5mongo11msgassertedEiPKc+0x129) [0x51f4a9] 
 /opt/mongodb/bin/mongos [0x69b163] 
 /opt/mongodb/bin/mongos [0x69acf2] 
 /opt/mongodb/bin/mongos [0x69acf2] 
 /opt/mongodb/bin/mongos [0x69acf2] 
 /opt/mongodb/bin/ 
mongos(_ZN5boost6detail8function17function_invoker4IPFbRN5mongo12DBClientBa seERKSsbiEbS5_S7_biE6invokeERNS1_15function_bufferES5_S7_bi 
+0x16) [0x576ba6] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo17ClientConnections13checkVersionsERKSs+0x1c6) 
[0x5774b6] 
 /opt/mongodb/bin/mongos(_ZN5mongo15ShardConnection5_initEv+0x2d0) 
[0x575630] 
 /opt/mongodb/bin/mongos(_ZN5mongo15ShardConnectionC1ERKNS_5ShardERKSs 
+0xa1) [0x575b31] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo15dbgrid_pub_cmds8CountCmd3runERKSsRNS_7BSONObjERSsRNS_14BS ONObjBuilderEb 
+0x9e1) [0x65f661] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo7Command20runAgainstRegisteredEPKcRNS_7BSONObjERNS_14BSONOb jBuilderE 
+0x67c) [0x57bdcc] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo14SingleStrategy7queryOpERNS_7RequestE+0x262) 
[0x631062] 
 /opt/mongodb/bin/mongos(_ZN5mongo7Request7processEi+0x29c) [0x66432c] 
 /opt/mongodb/bin/ 
mongos(_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21Abstract MessagingPortEPNS_9LastErrorE 
+0x77) [0x6761c7] 
 /opt/mongodb/bin/mongos(_ZN5mongo3pms9threadRunEPNS_13MessagingPortE 
+0x34c) [0x57ea3c] 
 /opt/mongodb/bin/mongos(thread_proxy+0x80) [0x69ec30] 
 /lib64/libpthread.so.0 [0x3a9be0673d] 
 /lib64/libc.so.6(clone+0x6d) [0x3a9b6d40cd] 
Tue Apr 12 01:20:15 [conn27] end connection 127.0.0.1:42975 
######################### 

Then I'm goint to the server1.domain.com.

[moskrc@server9 db]$ /opt/mongodb/bin/mongo server1.domain.com:28000 
MongoDB shell version: 1.8.1 
connecting to: server1.domain.com:28000/test 
rs1:SECONDARY> use mycms-prod 
switched to db mycms-prod 
rs1:SECONDARY> db.fs.chunks.count() 
Tue Apr 12 01:22:23 uncaught exception: count failed: { "errmsg" : 
"not master", "ok" : 0 } 
rs1:SECONDARY> 

I am think that mongos should not contact to this computer. Since it
is SECONDARY to the replica set.

This is a bug?

All the components of version 1.8.1.

There is a nuance. This database is restored with the help of
mongorestore.

I thought may be something wrong with the dump. I just created a new
database shard-test, copied into it 500 files (in gridfs) and
activated sharding.

Wait until all data is distributed across servers. And triedto make a
dump the database . Surprisingly, it worked out! From different mongos
works too. What does this mean?

This is console output: 
        { "_id" : "shard-test", "partitioned" : true, "primary" : "rs2" } 
                shard-test.fs.chunks chunks: 
                                rs1     3 
                                rs3     3 
                                rs2     5 
                        { "files_id" : { $minKey : 1 } } -->> { "files_id" : 
ObjectId("4da48f64d8b9bb5239000000") } on : rs1 { "t" : 2000, "i" : 
0 } 
                        { "files_id" : ObjectId("4da48f64d8b9bb5239000000") } -->> 
{ "files_id" : ObjectId("4da49002d8b9bb527400005d") } on : rs3 { "t" : 
3000, "i" : 0 } 
                        { "files_id" : ObjectId("4da49002d8b9bb527400005d") } -->> 
{ "files_id" : ObjectId("4da49006d8b9bb5274000132") } on : rs1 { "t" : 
4000, "i" : 0 } 
                        { "files_id" : ObjectId("4da49006d8b9bb5274000132") } -->> 
{ "files_id" : ObjectId("4da49009d8b9bb527400028e") } on : rs3 { "t" : 
5000, "i" : 0 } 
                        { "files_id" : ObjectId("4da49009d8b9bb527400028e") } -->> 
{ "files_id" : ObjectId("4da4900ed8b9bb52740003d9") } on : rs1 { "t" : 
6000, "i" : 0 } 
                        { "files_id" : ObjectId("4da4900ed8b9bb52740003d9") } -->> 
{ "files_id" : ObjectId("4da4902ad8b9bb5274000530") } on : rs3 { "t" : 
7000, "i" : 0 } 
                        { "files_id" : ObjectId("4da4902ad8b9bb5274000530") } -->> 
{ "files_id" : ObjectId("4da49032d8b9bb52740005e1") } on : rs2 { "t" : 
7000, "i" : 1 } 
                        { "files_id" : ObjectId("4da49032d8b9bb52740005e1") } -->> 
{ "files_id" : ObjectId("4da49039d8b9bb5274000697") } on : rs2 { "t" : 
2000, "i" : 2 } 
                        { "files_id" : ObjectId("4da49039d8b9bb5274000697") } -->> 
{ "files_id" : ObjectId("4da4906ed8b9bb5274000749") } on : rs2 { "t" : 
3000, "i" : 2 } 
                        { "files_id" : ObjectId("4da4906ed8b9bb5274000749") } -->> 
{ "files_id" : ObjectId("4da490a1d8b9bb52be000007") } on : rs2 { "t" : 
7000, "i" : 2 } 
                        { "files_id" : ObjectId("4da490a1d8b9bb52be000007") } -->> 
{ "files_id" : { $maxKey : 1 } } on : rs2 { "t" : 7000, "i" : 3 } 
> bye 

(env)[moskrc@server2 tmp]$ /opt/mongodb/bin/mongodump -h localhost: 
30000 -d shard-test 
connected to: localhost:30000 
DATABASE: shard-test     to     dump/shard-test 
        shard-test.system.indexes to dump/shard-test/system.indexes.bson 
                 4 objects 
        shard-test.fs.chunks to dump/shard-test/fs.chunks.bson 
                600/1496        40% 
                700/1496        46% 
                900/1496        60% 
                1100/1496       73% 
                1400/1496       93% 
                 1496 objects 
        shard-test.fs.files to dump/shard-test/fs.files.bson 
                 804 objects 

Noticed one more nuance.

If I do so:

[moskrc@server9 mycms-prod]$ /opt/mongodb/bin/mongodump -h localhost: 
30000 -d mycms-prod 
connected to: localhost:30000 
DATABASE: mycms-prod     to     dump/mycms-prod 
        mycms-prod.cms_comment to dump/mycms-prod/cms_comment.bson 
                 16 objects 
        mycms-prod.system.indexes to dump/mycms-prod/system.indexes.bson 
                 67 objects 
        mycms-prod.cms_pdfcontent to dump/mycms-prod/cms_pdfcontent.bson 
                 18 objects 
        mycms-prod.djangoratings_vote to dump/mycms-prod/ 
djangoratings_vote.bson 
                 25 objects 
        mycms-prod.auth_permission to dump/mycms-prod/auth_permission.bson 
                 192 objects 
        mycms-prod.tracking_pagevisit to dump/mycms-prod/ 
tracking_pagevisit.bson 
assertion: 11010 count fails:{ assertion: "setShardVersion failed 
host[server2.domain.com:28000] { errmsg: "not maste...", 
assertionCode: 10429, errmsg: "db assertion failure", ok: 0 } 

Error has occured on tracking_pagevisit collection.

Then... Let's try to dump this collection separately.

[moskrc@server9 mycms-prod]$ /opt/mongodb/bin/mongodump -h localhost: 
30000 -d mycms-prod -c tracking_pagevisit 
connected to: localhost:30000 
DATABASE: mycms-prod     to     dump/mycms-prod 
        mycms-prod.tracking_pagevisit to dump/mycms-prod/ 
tracking_pagevisit.bson 
                 14158 objects 

This work out!!! What's happening?

My system:

CentOS 5.5 

Kernel: Linux server9.domain.com 2.6.18-194.el5xen #1 SMP Fri Apr 2 15:34:40 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux 

I have 6 mongos. Actually used always only 2. For 2 applications. Each
application has its own mongos.

Total I have 9 servers. On each run mongod with params: shardsvr =
true replSet = rs1 (rs2 and rs3). Three replicas. Each replica
consists of a 3-mongod. And three config servers (server4.domain.com:
28001,server6.domain.com:28001,server1.domain.com:28001).

Mongos params
bind_ip = 127.0.0.1,123.456.789.12 port = 30000 fork = true configdb =
server4.domain.com:28001,server6.domain.com:28001,server1.domain.com:
28001

I restarted used mongos. That helped. Databases are now identical. But
the dump is still not working. I wrote the above error.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

私藏温柔 2024-11-08 01:32:28

这是 mongodb 错误。请参阅此处:https://jira.mongodb.org/browse/SERVER-2961

It's was mongodb bug. See here: https://jira.mongodb.org/browse/SERVER-2961

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文