mongodb 分片集群切换单个分片副本集primary的正确步骤

时间:2024-11-07 14:08:02

[mongodb@db_m1_slave_1 ~]$ /usr/local/mongodb-linux-x86_64-3.0.3/bin/mongo 10.254.3.72:27027                                                                                                                     

MongoDB shell version: 3.0.3

connecting to: 10.254.3.72:27027/test

shard1:PRIMARY> ("10.254.3.63:27017");

2016-07-11T20:36:01.314+0800 I NETWORK  DBClientCursor::init call() failed

2016-07-11T20:36:01.323+0800 E QUERY    Error: error doing query: failed

    at DBQuery._exec (src/mongo/shell/:83:36)

    at (src/mongo/shell/:240:10)

    at (src/mongo/shell/:187:19)

    at (src/mongo/shell/:58:41)

    at (src/mongo/shell/:66:41)

    at (src/mongo/shell/:1031:23)

    at (shell):1:4 at src/mongo/shell/:83

2016-07-11T20:36:01.326+0800 I NETWORK  trying reconnect to 10.254.3.72:27027 (10.254.3.72) failed

2016-07-11T20:36:01.327+0800 I NETWORK  reconnect 10.254.3.72:27027 (10.254.3.72) ok

shard1:PRIMARY>

shard1:PRIMARY>

shard1:PRIMARY> ();

{

         "set" : "shard1",

         "date" : ISODate("2016-07-11T12:36:20Z"),

         "myState" : 1,

         "members" : [

                   {

                            "_id" : 0,

                            "name" : "10.254.3.62:27017",

                            "health" : 1,

                            "state" : 2,

                            "stateStr" : "SECONDARY",

                            "uptime" : 19,

                            "optime" : Timestamp(1468240561, 1),

                            "optimeDate" : ISODate("2016-07-11T12:36:01Z"),

                            "lastHeartbeat" : ISODate("2016-07-11T12:36:19Z"),

                            "lastHeartbeatRecv" : ISODate("2016-07-11T12:36:20Z"),

                            "pingMs" : 0,

                            "lastHeartbeatMessage" : "syncing to: 10.254.3.72:27027",

                            "syncingTo" : "10.254.3.72:27027"

                   },

                   {

                            "_id" : 2,

                            "name" : "10.254.3.72:27017",

                            "health" : 1,

                            "state" : 7,

                            "stateStr" : "ARBITER",

                            "uptime" : 19,

                            "lastHeartbeat" : ISODate("2016-07-11T12:36:19Z"),

                            "lastHeartbeatRecv" : ISODate("2016-07-11T12:36:20Z"),

                            "pingMs" : 0

                   },

                   {

                            "_id" : 3,

                            "name" : "10.254.3.72:27027",

                            "health" : 1,

                            "state" : 1,

                            "stateStr" : "PRIMARY",

                            "uptime" : 33237,

                            "optime" : Timestamp(1468240561, 1),

                            "optimeDate" : ISODate("2016-07-11T12:36:01Z"),

                            "self" : true

                   }

         ],

         "ok" : 1

}

shard1:PRIMARY>