The $external useSource was somehow created as a database, which doesn't seem to be quite logical. It should be an external artifact I'd have thought.
I discovered this during testing of adding a sharded cluster infrastructure consisting of two already-Kerborised replica sets.
1. Step : added realm4 replica set as a shard
mongos> sh.addShard( "realm4/kserver1a.realm4.10gen.me:27017" ) { "shardAdded" : "realm4", "ok" : 1 }
2. Step : added realm5 set as a shard, however, this is rejected due to the existence of the $external database on both realms. This is logical but it means some reconfiguration if making two Kerberos-enabled replica sets part of a sharded cluster.
mongos> sh.addShard( "realm5/kserver1a.realm5.10gen.me:27017" ) { "ok" : 0, "errmsg" : "can't add shard realm5/kserver1a.realm5.10gen.me:27017 because a local database '$external' exists in another realm4:realm4/kserver1a.realm4.10gen.me:27017,kserver1b.realm4.10gen.me:27017,kserver1c.realm4.10gen.me:27017" }
So as expected, I can drop the $external database below -
realm5:PRIMARY> db.dropDatabase() { "dropped" : "$external", "ok" : 1 } realm5:PRIMARY> realm5:PRIMARY> realm5:PRIMARY> realm5:PRIMARY> show dbs $SERVER (empty) admin 0.0625GB db1 0.0625GB fred (empty) local 1.07763671875GB
After removing the $external database, I can now add realm5 as the second shard -
mongos> sh.addShard( "realm5/kserver1a.realm5.10gen.me:27017" ) { "shardAdded" : "realm5", "ok" : 1 }
mongos> sh.status() --- Sharding Status --- sharding version: { "_id" : 1, "version" : 3, "minCompatibleVersion" : 3, "currentVersion" : 4, "clusterId" : ObjectId("511a58f8bc0ae36e0fab6574") } shards: { "_id" : "realm4", "host" : "realm4/kserver1a.realm4.10gen.me:27017,kserver1b.realm4.10gen.me:27017,kserver1c.realm4.10gen.me:27017" } { "_id" : "realm5", "host" : "realm5/kserver1a.realm5.10gen.me:27017,kserver1b.realm5.10gen.me:27017,kserver1c.realm5.10gen.me:27017" } databases: { "_id" : "admin", "partitioned" : false, "primary" : "config" } { "_id" : "fred", "partitioned" : false, "primary" : "realm4" } { "_id" : "$external", "partitioned" : false, "primary" : "realm4" } { "_id" : "db1", "partitioned" : false, "primary" : "realm5" }
Out of curiousity what is the $SERVER database? I never created it.