How to change an existing MongoDB index?

I have a number of indexes in my MongoDB, and I think that one of the reasons I run the system on such a high processor is that updating the indexes is blocked. (The AWS micro instance runs at 50% + CPU during normal operation, 99.9% during heavy write operations).

I have a good share of indexes for quick queries, and now I think I can show some additional improvements by moving the index build to the background.

I don’t want to completely remove indexes (at least I don’t think I’m doing it), but I would be happy if only “future operations” were running in the background.

I looked at the documentation for building the mongo index http://www.mongodb.org/display/DOCS/Indexes and saw the flags to enable the background operation (see below), but I see nothing how to change the existing index.

 db.things.ensureIndex({x:1}, {background:true});
 > db.things.ensureIndex({name:1}, {background:true, unique:true,
 ... dropDups:true});

I tried to run the original index command a second time with the updated parameter, but when I re-execute the command db.colection.getIndexes();, it does not display the "background" parameter on the output.

{
    "_id" : ObjectId("4de2c1a5c9907a4e77467826"),
    "ns" : "mydb.items",
    "key" : {
        "itemA" : 1,
        "itemB" : -1,
        "itemC" : -1
    },
    "name" : "itemA_1_itemB_-1_itemC_-1",
    "v" : 0
}

Do I need to drop the index and start over? or is the index-in-background parameter simply not shown?

@TTT from comments: Do you want to update the index after updating, updating or deleting a document?

. , , , , . , Mongo 99,9% .

, , MONGO, , recalc.

" " , " " , ( ).

+3
1

, . , , .

EC2 Micro-, , , . - , . , , , .

Amazon EC2:

. -, .

2 EC2 ( )

, , - Linode VPS.

+3

All Articles