2014년 12월 13일 토요일

how to rename a shard?

I have a mongo shard setup which wasn't deployed correctly IMO and is using fixed addresses for shards:

mongos> db.runCommand({listshards:1})
{
        "shards" : [
                {
                        "_id" : "shard0001",
                        "host" : "ec2-aa-bb-cc-dd.compute-1.amazonaws.com:27018"
                },
                {
                        "_id" : "shard0002",
                        "host" : "ec2-bb-cc-dd-ee.compute-1.amazonaws.com:27018"
                },
                {
                        "_id" : "shard0003",
                        "host" : "xx.yy.zz.aa:27018"
(...)

How can I rename the shards, say, to shard0001.example.com,shard0002.example.com etc.?



Nobody knows? I'm running mongo 2.6.x if that helps.



It's this section of the docs:

http://docs.mongodb.org/manual/tutorial/convert-standalone-to-replica-set/#sharding-considerations



Cool, thanks.

For reference, for my 3-shard system, I've used something in the line of:

mongos> db.getSiblingDB("config").shards.save( {_id: "shard0001", host: "shard0001.example.com" } )
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

mongos> db.getSiblingDB("config").shards.save( {_id: "shard0002", host: "shard0002.example.com" } )
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

mongos> db.getSiblingDB("config").shards.save( {_id: "shard0003", host: "shard0003.example.com" } )
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

mongos> db.runCommand({listshards:1})
{
        "shards" : [
                {
                        "_id" : "shard0001",
                        "host" : "shard0001.example.com"
                },
                {
                        "_id" : "shard0002",
                        "host" : "shard0002.example.com"
                },
                {
                        "_id" : "shard0003",
                        "host" : "shard0003.example.com"
                }
        ],
        "ok" : 1
}



댓글 없음:

댓글 쓰기