0

我看到MongoDB 文档说删除索引是通过调用db.accounts.dropIndex( { "tax-id": 1 } ). 但它没有说明是否需要从副本集中删除节点。

我尝试使副本集中的辅助节点脱机并作为独立节点重新启动(在不同的端口中)并尝试删除索引。

但是在使用常规进程带回副本集中的节点后sudo service mongod start,mongod 进程正在死亡,说索引已损坏。

 Thu Oct 31 19:52:38.098 [repl writer worker 1] Assertion: 15898:error in index possibly corruption consider repairing 382
0xdddd81 0xd9f55b 0xd9fa9c 0x7edb83 0x7fb332 0x7fdc08 0x9d3b50 0x9c796e 0x9deb64 0xac45dd 0xac58df 0xa903fa 0xa924c7 0xa71f6c 0xc273d3 0xc26b18 0xdab721 0xe26609 0x7ff4d05f0c6b 0x7ff4cf9965ed
 /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0xdddd81]
 /usr/bin/mongod(_ZN5mongo11msgassertedEiPKc+0x9b) [0xd9f55b]
 /usr/bin/mongod() [0xd9fa9c]
 /usr/bin/mongod(_ZN5mongo11checkFailedEj+0x143) [0x7edb83]
 /usr/bin/mongod(_ZNK5mongo12BucketBasicsINS_12BtreeData_V1EE11basicInsertENS_7DiskLocERiS3_RKNS_5KeyV1ERKNS_8OrderingE+0x222) [0x7fb332]
 /usr/bin/mongod(_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE10insertHereENS_7DiskLocEiS3_RKNS_5KeyV1ERKNS_8OrderingES3_S3_RNS_12IndexDetailsE+0x68) [0x7fdc08]
 /usr/bin/mongod(_ZNK5mongo30IndexInsertionContinuationImplINS_12BtreeData_V1EE22doIndexInsertionWritesEv+0xa0) [0x9d3b50]
 /usr/bin/mongod(_ZN5mongo14IndexInterface13IndexInserter19finishAllInsertionsEv+0x1e) [0x9c796e]
 /usr/bin/mongod(_ZN5mongo24indexRecordUsingTwoStepsEPKcPNS_16NamespaceDetailsENS_7BSONObjENS_7DiskLocEb+0x754) [0x9deb64]
 /usr/bin/mongod(_ZN5mongo11DataFileMgr6insertEPKcPKvibbbPb+0x123d) [0xac45dd]
 /usr/bin/mongod(_ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEbb+0x4f) [0xac58df]
 /usr/bin/mongod(_ZN5mongo14_updateObjectsEbPKcRKNS_7BSONObjES4_bbbRNS_7OpDebugEPNS_11RemoveSaverEbRKNS_24QueryPlanSelectionPolicyEb+0x2eda) [0xa903fa]
 /usr/bin/mongod(_ZN5mongo27updateObjectsForReplicationEPKcRKNS_7BSONObjES4_bbbRNS_7OpDebugEbRKNS_24QueryPlanSelectionPolicyE+0xb7) [0xa924c7]
 /usr/bin/mongod(_ZN5mongo21applyOperation_inlockERKNS_7BSONObjEbb+0x65c) [0xa71f6c]
 /usr/bin/mongod(_ZN5mongo7replset8SyncTail9syncApplyERKNS_7BSONObjEb+0x713) [0xc273d3]
 /usr/bin/mongod(_ZN5mongo7replset14multiSyncApplyERKSt6vectorINS_7BSONObjESaIS2_EEPNS0_8SyncTailE+0x48) [0xc26b18]
 /usr/bin/mongod(_ZN5mongo10threadpool6Worker4loopEv+0x281) [0xdab721]
 /usr/bin/mongod() [0xe26609]
 /lib64/libpthread.so.0(+0x7c6b) [0x7ff4d05f0c6b]
 /lib64/libc.so.6(clone+0x6d) [0x7ff4cf9965ed]
Thu Oct 31 19:52:38.106 [repl writer worker 1] ERROR: writer worker caught exception: error in index possibly corruption consider repairing 382 on: 

xxxxxxxx--删除了与数据相关的内容...xxxxxxxxxxxx

Thu Oct 31 19:52:38.106 [repl writer worker 1]   Fatal Assertion 16360
0xdddd81 0xd9dc13 0xc26bfc 0xdab721 0xe26609 0x7ff4d05f0c6b 0x7ff4cf9965ed
 /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0xdddd81]
 /usr/bin/mongod(_ZN5mongo13fassertFailedEi+0xa3) [0xd9dc13]
 /usr/bin/mongod(_ZN5mongo7replset14multiSyncApplyERKSt6vectorINS_7BSONObjESaIS2_EEPNS0_8SyncTailE+0x12c) [0xc26bfc]
 /usr/bin/mongod(_ZN5mongo10threadpool6Worker4loopEv+0x281) [0xdab721]
 /usr/bin/mongod() [0xe26609]
 /lib64/libpthread.so.0(+0x7c6b) [0x7ff4d05f0c6b]
 /lib64/libc.so.6(clone+0x6d) [0x7ff4cf9965ed]
Thu Oct 31 19:52:38.108 [repl writer worker 1]

***aborting after fassert() failure


Thu Oct 31 19:52:38.108 Got signal: 6 (Aborted).

这是由于在辅助节点上以离线模式删除索引吗?非常感谢有关删除索引的正确方法的任何建议。

4

1 回答 1

2

从副本集中删除索引的正确方法是将其放到主副本上。副本的想法是拥有相同的数据副本(时间滞后小)。因此,每当您在主节点上执行某些操作时,都会将其复制到辅助节点。因此,如果您开始在主节点上执行任何操作,则在它完成此过程后,该过程会立即传播到辅助节点。

如果您要从主服务器中删除索引 - 索引也将在辅助服务器上删除。

于 2013-10-31T23:10:56.190 回答