MongoDB – How to Change Replica Set Protocol Version

databaselinuxmongodbreplica-setreplication

I'm trying to change Replica Set Protocol to pv1. I have 5 replica set servers Mongo 3.6. I'm using the documentation from here https://docs.mongodb.com/manual/reference/replica-set-protocol-versions/ to make those changes.

The documentation is pretty clear and operation seems simple https://docs.mongodb.com/manual/reference/replica-set-protocol-versions/#modify-replica-set-protocol-version. On PRIMARY server I executed this three commands:

cfg = rs.conf();
cfg.protocolVersion=1;
rs.reconfig(cfg);

After doing it I'm getting :

rs.reconfig(cfg);
{
    "ok" : 1,
    "operationTime" : Timestamp(1531825299, 3),
    "$clusterTime" : {
        "clusterTime" : Timestamp(1531825299, 3),
        "signature" : {
            "hash" : BinData(0,"AIwmnD882cUdRgKYgGsRZg9Z4q0="),
            "keyId" : NumberLong("6577197549977862145")
        }
    }
}

Everything looks good, but after relogin to mongo I can see this:

MongoDB shell version v3.6.6
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.6
Server has startup warnings: 
2018-07-10T22:50:39.164+0200 I REPL     [replexec-0] 
2018-07-10T22:50:39.164+0200 I REPL     [replexec-0] ** WARNING: This replica set was configured with protocol version 0.
2018-07-10T22:50:39.164+0200 I REPL     [replexec-0] **          This protocol version is deprecated and subject to be removed 
2018-07-10T22:50:39.164+0200 I REPL     [replexec-0] **          in a future version.

I don't know what I'm doing wrong? Any help why this operation doesn't work ?

Best Answer

You need to restart the mongod service after rs.reconfig(cfg). The reconfig will change the protocol version but it will be active after the restart. First you need to restart the secondary, then do a stepdown for the primary and restart it also. After that you will not see the warning anymore.