MongoDB 3.2 升級至 3.4.6

haoge0205發表於2019-10-10

MongoDB 升級測試步驟:

1、MongoDB版本升級順序3.2->3.4->3.6->4.0 不能跨版本升級

2、升級到3.4後,您不能降級到3.2.7或更早版本。您只能降級到3.2.8或更高版本

3、先升級所有副本集中的Secondary

4、將Primary節點降級為Secondary節點

5、升級Primary

6、MongoDB3.2升級到3.4,登入後檢視版本資訊若還是3.2,執行db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )

7、MongoDB3.4升級到3.6,登入後檢視版本資訊若還是3.4,執行db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )

8、MongoDB3.6升級到4.0,登入後檢視版本資訊若還是3.6,執行db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )

###只在升級到4.0執行###

  cfg = rs.conf();

  cfg.protocolVersion=1;

  rs.reconfig(cfg);



檢視MongoDB程式:

[root@127.0.0.1 bin]# ps -ef | grep mongo

root      17908   9428  0 20:43 pts/1    00:00:00 grep mongo

root      47265      1  0 Oct09 ?        00:09:38 /u02/mongodb/mongodb/bin/mongod -f /u02/mongodb/mongodb/2777/conf/mongodb_2777.conf

root     179052      1  0 Oct09 ?        00:05:27 /u02/mongodb/mongodb/bin/mongod -f /u02/mongodb/mongodb/5777/conf/mongodb_5777.conf

root     180521      1  2 Oct08 ?        00:59:01 /u02/mongodb/mongodb/bin/mongod -f /u02/mongodb/mongodb/3777/conf/mongodb_3777.conf

root     185602      1  0 Oct08 ?        00:08:30 /u02/mongodb/mongodb/bin/mongod -f /u02/mongodb/mongodb/4777/conf/mongodb_4777.conf


埠5777為Primary,2777,3777,4777為Secondary



登入副本集檢視副本集資訊:

[root@127.0.0.1 bin]# /u02/mongodb/mongodb/bin/mongo --port 5777

MongoDB shell version: 3.2.6

connecting to: 127.0.0.1:5777/test

Server has startup warnings: 

2019-10-09T15:08:26.464+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-09T15:08:26.464+0800 I CONTROL  [initandlisten] 

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] 

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] 

shard1:PRIMARY> rs.status()

{

        "set" : "shard1",

        "date" : ISODate("2019-10-10T12:42:36.196Z"),

        "myState" : 1,

        "term" : NumberLong(4),

        "heartbeatIntervalMillis" : NumberLong(2000),

        "members" : [

                {

                        "_id" : 1,

                        "name" : "127.0.0.1:3777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 106410,

                        "optime" : {

                                "ts" : Timestamp(1570711316, 2),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:41:56Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:42:34.326Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:42:35.321Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 21

                },

                {

                        "_id" : 2,

                        "name" : "127.0.0.1:4777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 106410,

                        "optime" : {

                                "ts" : Timestamp(1570711316, 2),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:41:56Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:42:34.324Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:42:35.321Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 21

                },

                {

                        "_id" : 3,

                        "name" : "127.0.0.1:5777",

                        "health" : 1,

                        "state" : 1,

                        "stateStr" : "PRIMARY",

                        "uptime" : 106450,

                        "optime" : {

                                "ts" : Timestamp(1570711316, 2),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:41:56Z"),

                        "electionTime" : Timestamp(1570711316, 1),

                        "electionDate" : ISODate("2019-10-10T12:41:56Z"),

                        "configVersion" : 21,

                        "self" : true

                },

                {

                        "_id" : 4,

                        "name" : "127.0.0.1:2777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 100601,

                        "optime" : {

                                "ts" : Timestamp(1570711316, 2),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:41:56Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:42:34.324Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:42:35.319Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 21

                }

        ],

        "ok" : 1

}


將mongodb-linux-x86_64-rhel62-3.4.6.tgz放在/opt下解壓後改名

[root@127.0.0.1 bin]# ls

bsondump  mongo  mongod  mongodump  mongoexport  mongofiles  mongoimport  mongooplog  mongoperf  mongoreplay  mongorestore  mongos  mongostat  mongotop

[root@127.0.0.1 bin]# pwd

/opt/mongodb_3_4/bin


刪除副本:

shard1:PRIMARY> rs.remove("127.0.0.1:2777")


關閉2777埠mongo

[root@127.0.0.1 bin]# /mongodb/mongodb/bin/mongod -f /u02/mongodb/mongodb/2777/conf/mongodb_2777.conf --shutdown


透過mongodb3.4啟動埠2777mongo,升級至3.4

/opt/mongodb_3_4/bin/mongod -f /u02/mongodb/mongodb/2777/conf/mongodb_2777.conf


登入mongo檢視版本資訊

[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 2777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:2777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] 


將埠2777mongo新增到副本集

shard1:PRIMARY> rs.add("127.0.0.1:2777")


檢視2777埠副本集資訊

shard1:PRIMARY> rs.status()

{

        "set" : "shard1",

        "date" : ISODate("2019-10-10T12:49:24.623Z"),

        "myState" : 1,

        "term" : NumberLong(4),

        "heartbeatIntervalMillis" : NumberLong(2000),

        "members" : [

                {

                        "_id" : 1,

                        "name" : "127.0.0.1:3777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 106819,

                        "optime" : {

                                "ts" : Timestamp(1570711316, 2),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:41:56Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:49:24.438Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:49:23.376Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 21

                },

                {

                        "_id" : 2,

                        "name" : "127.0.0.1:4777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 106819,

                        "optime" : {

                                "ts" : Timestamp(1570711316, 2),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:41:56Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:49:24.438Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:49:23.374Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 21

                },

                {

                        "_id" : 3,

                        "name" : "127.0.0.1:5777",

                        "health" : 1,

                        "state" : 1,

                        "stateStr" : "PRIMARY",

                        "uptime" : 106858,

                        "optime" : {

                                "ts" : Timestamp(1570711316, 2),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:41:56Z"),

                        "electionTime" : Timestamp(1570711316, 1),

                        "electionDate" : ISODate("2019-10-10T12:41:56Z"),

                        "configVersion" : 21,

                        "self" : true

                },

                {

                        "_id" : 4,

                        "name" : "127.0.0.1:2777",                       

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",                                      

                        "uptime" : 101009,

                        "optime" : {

                                "ts" : Timestamp(1570711316, 2),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:41:56Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:49:24.405Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:49:23.375Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 21

                }

        ],

        "ok" : 1

}



登入mongo3.4版本2777埠查詢資料測試

[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 2777    

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:2777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] 

shard1:SECONDARY> rs.slaveOk()

shard1:SECONDARY> show dbs

local  0.001GB

test   0.000GB

yoon   0.000GB

shard1:SECONDARY> use yoon

switched to db yoon

shard1:SECONDARY> show collections

movie

shard1:SECONDARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }



透過mongodb3.4啟動埠3777mongo,升級至3.4

[root@127.0.0.1 bin]# /u02/mongodb/mongodb/bin/mongo --port 5777

MongoDB shell version: 3.2.6

connecting to: 127.0.0.1:5777/test

Server has startup warnings: 

2019-10-09T15:08:26.464+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-09T15:08:26.464+0800 I CONTROL  [initandlisten] 

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] 

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] 

shard1:PRIMARY> rs.remove("127.0.0.1:3777")

{ "ok" : 1 }

shard1:PRIMARY> rs.status()

{

        "set" : "shard1",

        "date" : ISODate("2019-10-10T12:52:37.517Z"),

        "myState" : 1,

        "term" : NumberLong(4),

        "heartbeatIntervalMillis" : NumberLong(2000),

        "members" : [

                {

                        "_id" : 2,

                        "name" : "127.0.0.1:4777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 107011,

                        "optime" : {

                                "ts" : Timestamp(1570711953, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:52:33Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:52:37.379Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:52:37.379Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 22

                },

                {

                        "_id" : 3,

                        "name" : "127.0.0.1:5777",

                        "health" : 1,

                        "state" : 1,

                        "stateStr" : "PRIMARY",

                        "uptime" : 107051,

                        "optime" : {

                                "ts" : Timestamp(1570711953, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:52:33Z"),

                        "electionTime" : Timestamp(1570711316, 1),

                        "electionDate" : ISODate("2019-10-10T12:41:56Z"),

                        "configVersion" : 22,

                        "self" : true

                },

                {

                        "_id" : 4,

                        "name" : "127.0.0.1:2777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 101202,

                        "optime" : {

                                "ts" : Timestamp(1570711953, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:52:33Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:52:37.379Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:52:37.379Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 22

                }

        ],

        "ok" : 1

}


[root@127.0.0.1 bin]# /u02/mongodb/mongodb/bin/mongod -f /u02/mongodb/mongodb/3777/conf/mongodb_3777.conf --shutdown

killing process with pid: 180521


[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongod -f /u02/mongodb/mongodb/3777/conf/mongodb_3777.conf

about to fork child process, waiting until server is ready for connections.

forked process: 25117

child process started successfully, parent exiting


[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 3777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:3777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] 

shard1:OTHER>    


3777埠升級至3.4.6版本,將3777埠加入副本集

[root@127.0.0.1 bin]# /u02/mongodb/mongodb/bin/mongo --port 5777

MongoDB shell version: 3.2.6

connecting to: 127.0.0.1:5777/test

Server has startup warnings: 

2019-10-09T15:08:26.464+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-09T15:08:26.464+0800 I CONTROL  [initandlisten] 

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] 

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] 

shard1:PRIMARY> rs.add("127.0.0.1:3777")

{ "ok" : 1 }

shard1:PRIMARY> rs.status()

{

        "set" : "shard1",

        "date" : ISODate("2019-10-10T12:55:20.927Z"),

        "myState" : 1,

        "term" : NumberLong(4),

        "heartbeatIntervalMillis" : NumberLong(2000),

        "members" : [

                {

                        "_id" : 2,

                        "name" : "127.0.0.1:4777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 107175,

                        "optime" : {

                                "ts" : Timestamp(1570712117, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:55:17Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:55:19.964Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:55:19.964Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 23

                },

                {

                        "_id" : 3,

                        "name" : "127.0.0.1:5777",

                        "health" : 1,

                        "state" : 1,

                        "stateStr" : "PRIMARY",

                        "uptime" : 107214,

                        "optime" : {

                                "ts" : Timestamp(1570712117, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:55:17Z"),

                        "electionTime" : Timestamp(1570711316, 1),

                        "electionDate" : ISODate("2019-10-10T12:41:56Z"),

                        "configVersion" : 23,

                        "self" : true

                },

                {

                        "_id" : 4,

                        "name" : "127.0.0.1:2777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 101365,

                        "optime" : {

                                "ts" : Timestamp(1570712117, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:55:17Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:55:19.964Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:55:19.965Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 23

                },

                {

                        "_id" : 5,

                        "name" : "127.0.0.1:3777",

                        "health" : 1,

                        "state" : 5,

                        "stateStr" : "STARTUP2",

                        "uptime" : 0,

                        "optime" : {

                                "ts" : Timestamp(1570711953, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T12:52:33Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T12:55:19.964Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T12:55:17.966Z"),

                        "pingMs" : NumberLong(0),

                        "configVersion" : 23

                }

        ],

        "ok" : 1

}



在Primary插入一條新資料在3777埠查詢測試


檢視DB

shard1:PRIMARY> show dbs

local  0.001GB

test   0.000GB

yoon   0.000GB


連線DB

shard1:PRIMARY> use yoon

switched to db yoon


檢視DB下表

shard1:PRIMARY> show collections;

movie


查詢資料

shard1:PRIMARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }


當前連線DB

shard1:PRIMARY> db

yoon


插入一條新資料

shard1:PRIMARY> db.movie.insert({"kname":"shouqi"})

WriteResult({ "nInserted" : 1 })


查詢資料

shard1:PRIMARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }

{ "_id" : ObjectId("5d9f2aacdaabe0e11aebef86"), "kname" : "shouqi" }



登入2777和3777埠分別檢視{ "_id" : ObjectId("5d9f2aacdaabe0e11aebef86"), "kname" : "shouqi" }

[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 2777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:2777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-09T16:41:23.659+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] 

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-09T16:41:23.660+0800 I CONTROL  [initandlisten] 

shard1:SECONDARY> rs.slaveOk()

shard1:SECONDARY> use yoon

switched to db yoon

shard1:SECONDARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }

{ "_id" : ObjectId("5d9f2aacdaabe0e11aebef86"), "kname" : "shouqi" }

shard1:SECONDARY> 



[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 3777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:3777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] 

shard1:SECONDARY> rs.slaveOk()

shard1:SECONDARY> use yoon

switched to db yoon

shard1:SECONDARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }

{ "_id" : ObjectId("5d9f2aacdaabe0e11aebef86"), "kname" : "shouqi" }



以此類推升級埠4777,至3.4.6

shard1:PRIMARY> rs.remove("127.0.0.1:4777")

{ "ok" : 1 }


[root@127.0.0.1 bin]# /u02/mongodb/mongodb/bin/mongod -f /u02/mongodb/mongodb/4777/conf/mongodb_4777.conf --shutdown

killing process with pid: 185602


[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongod -f /u02/mongodb/mongodb/4777/conf/mongodb_4777.conf

about to fork child process, waiting until server is ready for connections.

forked process: 34453

child process started successfully, parent exiting


[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 4777    

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:4777/

MongoDB server version: 3.4.6


將4777埠新增到副本集

[root@127.0.0.1 bin]# /u02/mongodb/mongodb/bin/mongo --port 5777

MongoDB shell version: 3.2.6

connecting to: 127.0.0.1:5777/test

Server has startup warnings: 

2019-10-09T15:08:26.464+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-09T15:08:26.464+0800 I CONTROL  [initandlisten] 

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] 

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-09T15:08:26.465+0800 I CONTROL  [initandlisten] 

shard1:PRIMARY> rs.add("127.0.0.1:4777")

{ "ok" : 1 }

shard1:PRIMARY> rs.status()

{

        "set" : "shard1",

        "date" : ISODate("2019-10-10T13:07:58.679Z"),

        "myState" : 1,

        "term" : NumberLong(4),

        "heartbeatIntervalMillis" : NumberLong(2000),

        "members" : [

                {

                        "_id" : 3,

                        "name" : "127.0.0.1:5777",

                        "health" : 1,

                        "state" : 1,

                        "stateStr" : "PRIMARY",

                        "uptime" : 107972,

                        "optime" : {

                                "ts" : Timestamp(1570712875, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T13:07:55Z"),

                        "electionTime" : Timestamp(1570711316, 1),

                        "electionDate" : ISODate("2019-10-10T12:41:56Z"),

                        "configVersion" : 25,

                        "self" : true

                },

                {

                        "_id" : 4,

                        "name" : "127.0.0.1:2777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 102123,

                        "optime" : {

                                "ts" : Timestamp(1570712875, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T13:07:55Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T13:07:57.987Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T13:07:55.990Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 25

                },

                {

                        "_id" : 5,

                        "name" : "127.0.0.1:3777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 758,

                        "optime" : {

                                "ts" : Timestamp(1570712875, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T13:07:55Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T13:07:57.987Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T13:07:55.990Z"),

                        "pingMs" : NumberLong(0),

                        "syncingTo" : "127.0.0.1:5777",

                        "configVersion" : 25

                },

                {

                        "_id" : 6,

                        "name" : "127.0.0.1:4777",

                        "health" : 1,

                        "state" : 5,

                        "stateStr" : "STARTUP2",

                        "uptime" : 0,

                        "optime" : {

                                "ts" : Timestamp(1570712743, 1),

                                "t" : NumberLong(4)

                        },

                        "optimeDate" : ISODate("2019-10-10T13:05:43Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T13:07:57.987Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T13:07:55.990Z"),

                        "pingMs" : NumberLong(0),

                        "configVersion" : 25

                }

        ],

        "ok" : 1

}



將Primary升級至3.4.6


將Primary節點降級為Secondary節點,有兩種方式,一種是rs.stepDown() , 另一種是透過修改優先順序來修改Primary

shard1:PRIMARY> rs.stepDown()

透過優先順序來修改PRIMARY

shard1:PRIMARY> config=rs.conf()      //檢視當前配置,存入config變數中


shard1:PRIMARY> config.members[0].priority = 50         //修改config變數,第1組成員的優先順序為50


shard1:PRIMARY> rs.reconfig(config)             //配置生效


shard1:PRIMARY> rs.config()                   //檢視當前配置

{

"_id" : "shard1",

"version" : 18,

"protocolVersion" : NumberLong(1),

"members" : [

{

"_id" : 1,

"host" : "127.0.0.1:3777",

"arbiterOnly" : false,

"buildIndexes" : true,

"hidden" : false,

"priority" : 50,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

},

{

"_id" : 2,

"host" : "127.0.0.1:4777",

"arbiterOnly" : false,

"buildIndexes" : true,

"hidden" : false,

"priority" : 1,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

},

{

"_id" : 3,

"host" : "127.0.0.1:5777",

"arbiterOnly" : false,

"buildIndexes" : true,

"hidden" : false,

"priority" : 1,

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

},

{

"_id" : 4,

"host" : "127.0.0.1:2777",

"arbiterOnly" : false,

"buildIndexes" : true,

"hidden" : false,

"priority" : 1,                                    

"tags" : {

},

"slaveDelay" : NumberLong(0),

"votes" : 1

}

],

"settings" : {

"chainingAllowed" : true,

"heartbeatIntervalMillis" : 2000,

"heartbeatTimeoutSecs" : 10,

"electionTimeoutMillis" : 10000,

"getLastErrorModes" : {

},

"getLastErrorDefaults" : {

"w" : 1,

"wtimeout" : 0

},

"replicaSetId" : ObjectId("5d9c7a7e76695600e03e231f")

}

}


登入3777埠變為Primary

[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 3777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:3777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] 

shard1:PRIMARY> 


升級5777埠

shard1:PRIMARY> rs.remove("127.0.0.1:5777")

{ "ok" : 1 }


[root@127.0.0.1 bin]# /u02/mongodb/mongodb/bin/mongod -f /u02/mongodb/mongodb/5777/conf/mongodb_5777.conf --shutdown

killing process with pid: 179052


[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongod -f /u02/mongodb/mongodb/5777/conf/mongodb_5777.conf

about to fork child process, waiting until server is ready for connections.

forked process: 40446

child process started successfully, parent exiting


[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 5777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:5777/

MongoDB server version: 3.4.6


將5777埠新增至副本集

[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 3777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:3777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-10T20:53:40.536+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] 

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-10T20:53:40.537+0800 I CONTROL  [initandlisten] 

shard1:PRIMARY> rs.add("127.0.0.1:5777")

{ "ok" : 1 }


shard1:PRIMARY> rs.status()

{

        "set" : "shard1",

        "date" : ISODate("2019-10-10T13:16:30.878Z"),

        "myState" : 1,

        "term" : NumberLong(5),

        "heartbeatIntervalMillis" : NumberLong(2000),

        "optimes" : {

                "lastCommittedOpTime" : {

                        "ts" : Timestamp(1570713376, 1),

                        "t" : NumberLong(5)

                },

                "appliedOpTime" : {

                        "ts" : Timestamp(1570713376, 1),

                        "t" : NumberLong(5)

                },

                "durableOpTime" : {

                        "ts" : Timestamp(1570713376, 1),

                        "t" : NumberLong(5)

                }

        },

        "members" : [

                {

                        "_id" : 4,

                        "name" : "127.0.0.1:2777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 1272,

                        "optime" : {

                                "ts" : Timestamp(1570713376, 1),

                                "t" : NumberLong(5)

                        },

                        "optimeDurable" : {

                                "ts" : Timestamp(1570713376, 1),

                                "t" : NumberLong(5)

                        },

                        "optimeDate" : ISODate("2019-10-10T13:16:16Z"),

                        "optimeDurableDate" : ISODate("2019-10-10T13:16:16Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T13:16:28.911Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T13:16:26.912Z"),

                        "pingMs" : NumberLong(0),

                        "configVersion" : 28

                },

                {

                        "_id" : 5,

                        "name" : "127.0.0.1:3777",

                        "health" : 1,

                        "state" : 1,

                        "stateStr" : "PRIMARY",

                        "uptime" : 1370,

                        "optime" : {

                                "ts" : Timestamp(1570713376, 1),

                                "t" : NumberLong(5)

                        },

                        "optimeDate" : ISODate("2019-10-10T13:16:16Z"),

                        "electionTime" : Timestamp(1570713059, 1),

                        "electionDate" : ISODate("2019-10-10T13:10:59Z"),

                        "configVersion" : 28,

                        "self" : true

                },

                {

                        "_id" : 6,

                        "name" : "127.0.0.1:4777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 514,

                        "optime" : {

                                "ts" : Timestamp(1570713376, 1),

                                "t" : NumberLong(5)

                        },

                        "optimeDurable" : {

                                "ts" : Timestamp(1570713376, 1),

                                "t" : NumberLong(5)

                        },

                        "optimeDate" : ISODate("2019-10-10T13:16:16Z"),

                        "optimeDurableDate" : ISODate("2019-10-10T13:16:16Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T13:16:28.911Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T13:16:26.912Z"),

                        "pingMs" : NumberLong(0),

                        "configVersion" : 28

                },

                {

                        "_id" : 7,

                        "name" : "127.0.0.1:5777",

                        "health" : 1,

                        "state" : 2,

                        "stateStr" : "SECONDARY",

                        "uptime" : 11,

                        "optime" : {

                                "ts" : Timestamp(1570713376, 1),

                                "t" : NumberLong(5)

                        },

                        "optimeDurable" : {

                                "ts" : Timestamp(1570713376, 1),

                                "t" : NumberLong(5)

                        },

                        "optimeDate" : ISODate("2019-10-10T13:16:16Z"),

                        "optimeDurableDate" : ISODate("2019-10-10T13:16:16Z"),

                        "lastHeartbeat" : ISODate("2019-10-10T13:16:28.911Z"),

                        "lastHeartbeatRecv" : ISODate("2019-10-10T13:16:27.075Z"),

                        "pingMs" : NumberLong(0),

                        "configVersion" : 28

                }

        ],

        "ok" : 1

}


在Primary插入資料,在所有埠Secondary測試資料是否正常

shard1:PRIMARY> db.movie.insert({"shouyue":"yunweibu"})

WriteResult({ "nInserted" : 1 })


shard1:PRIMARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }

{ "_id" : ObjectId("5d9f2aacdaabe0e11aebef86"), "kname" : "shouqi" }

{ "_id" : ObjectId("5d9f2fa0b384f3ba8df3a0ce"), "shouyue" : "yunweibu" }   #檢視各埠是否有此條資料


2777埠:

[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 2777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:2777/

MongoDB server version: 3.4.6

shard1:SECONDARY> show dbs

2019-10-10T21:19:51.176+0800 E QUERY    [thread1] Error: listDatabases failed:{

        "ok" : 0,

        "errmsg" : "not master and slaveOk=false",

        "code" : 13435,

        "codeName" : "NotMasterNoSlaveOk"

} :

_getErrorWithCode@src/mongo/shell/utils.js:25:13

Mongo.prototype.getDBs@src/mongo/shell/mongo.js:62:1

shellHelper.show@src/mongo/shell/utils.js:769:19

shellHelper@src/mongo/shell/utils.js:659:15

@(shellhelp2):1:1

shard1:SECONDARY> rs.slaveOk()

shard1:SECONDARY> use yoon

switched to db yoon

shard1:SECONDARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }

{ "_id" : ObjectId("5d9f2aacdaabe0e11aebef86"), "kname" : "shouqi" }

{ "_id" : ObjectId("5d9f2fa0b384f3ba8df3a0ce"), "shouyue" : "yunweibu" }


4777埠:

[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 4777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:4777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] 

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] 

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] 

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-10T21:07:05.390+0800 I CONTROL  [initandlisten] 

shard1:SECONDARY> rs.slaveOk()

shard1:SECONDARY> use yoon

switched to db yoon

shard1:SECONDARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }

{ "_id" : ObjectId("5d9f2aacdaabe0e11aebef86"), "kname" : "shouqi" }

{ "_id" : ObjectId("5d9f2fa0b384f3ba8df3a0ce"), "shouyue" : "yunweibu" }


5777埠:

[root@127.0.0.1 bin]# /opt/mongodb_3_4/bin/mongo --port 5777

MongoDB shell version v3.4.6

connecting to: mongodb://127.0.0.1:5777/

MongoDB server version: 3.4.6

Server has startup warnings: 

2019-10-10T21:15:35.059+0800 I CONTROL  [initandlisten] 

2019-10-10T21:15:35.059+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2019-10-10T21:15:35.059+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2019-10-10T21:15:35.059+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2019-10-10T21:15:35.059+0800 I CONTROL  [initandlisten] 

2019-10-10T21:15:35.060+0800 I CONTROL  [initandlisten] 

2019-10-10T21:15:35.060+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.

2019-10-10T21:15:35.060+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:

2019-10-10T21:15:35.060+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

2019-10-10T21:15:35.060+0800 I CONTROL  [initandlisten] 

shard1:SECONDARY> rs.slaveOk()

shard1:SECONDARY> use yoon

switched to db yoon

shard1:SECONDARY> db.movie.find()

{ "_id" : ObjectId("5d9c7ee9d7a8df8fd023d6ed"), "name" : "hank" }

{ "_id" : ObjectId("5d9d9d5d159fa59c5d01985a"), "hname" : "yoon" }

{ "_id" : ObjectId("5d9d9e33159fa59c5d01985b"), "yname" : "hankyoon" }

{ "_id" : ObjectId("5d9f2aacdaabe0e11aebef86"), "kname" : "shouqi" }

{ "_id" : ObjectId("5d9f2fa0b384f3ba8df3a0ce"), "shouyue" : "yunweibu" }


MongoDB3.2升級至3.4.6升級完成。


但是真正的升級線上需要開發,測試配合來完成,保證升級的可用性。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28939273/viewspace-2659431/,如需轉載,請註明出處,否則將追究法律責任。

相關文章