HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Is it safe to remove an entry in a "config.mongos" MongoDB collection?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
entrymongodbcollectionmongosremoveconfigsafe

Problem

There are old entries in my "config.mongos"; they reference hosts which previously had "mongos" running on them but no longer do.

Can I safely remove those entries?

e.g.,:
# Old entries
{ "_id" : "silicon:27117", "ping" : ISODate("2012-12-27T19:51:04.560Z"), "up" : 9301, "waiting" : true }
...
# Current entries
{ "_id" : "app1:27017", "ping" : ISODate("2013-06-07T17:12:02.856Z"), "up" : 5593404, "waiting" : true }
{ "_id" : "app2:27017", "ping" : ISODate("2013-06-07T16:17:49.812Z"), "up" : 5590271, "waiting" : false }
{ "_id" : "app4:27017", "ping" : ISODate("2013-06-07T17:12:02.110Z"), "up" : 5593413, "waiting" : true }
{ "_id" : "app3:27017", "ping" : ISODate("2013-06-07T17:12:02.854Z"), "up" : 5593578, "waiting" : true }


Update:

One reason why having these old entries in config.mongos is a problem is that making changes to the shard takes a long time, while we wait for old mongoses to time out.

For example, stopping the balancer takes a long time (several minutes):

```
mongos> sh.stopBalancer()
Waiting for active hosts...
Waiting for active host magnesium:27117 to recognize new settings... (ping : Thu Dec 22 2011 03:08:14 GMT+0000 (UTC))
Waited for active ping to change for host magnesium:27117, a migration may be in progress or the host may be down.
Waiting for active host Boron:27017 to recognize new settings... (ping : Tue Jan 31 2012 21:48:12 GMT+0000 (UTC))
Waited for active ping to change for host Boron:27017, a migration may be in progress or the host may be down.
Waiting for active host Beryllium:27017 to recognize new settings... (ping : Wed Feb 01 2012 17:34:15 GMT+0000 (UTC))
Waited for active ping to change for host Beryllium:27017, a migration may be in progress or the host may be down.
Waiting for active host helium:27017 to recognize new settings... (ping : Mon Jun 10 2013 19:07:41 GMT+0000 (UTC))
Waited for active ping to change for host helium:27017, a migration may be in progress or the host may be down.
Waiting for active host

Solution

You can remove these entries, but there is really no reason to do so. The config.mongos collection just records all mongos processes that have connected to the config server in question. Hence any that reconnect at any point will just show up again - it's a book keeping thing, and only takes up a few KB at most, there's no need to delete them.

Context

StackExchange Database Administrators Q#44072, answer score: 3

Revisions (0)

No revisions yet.