大网数据广告活动
服务器运维问答

How to Change Replica Set Protocol Version in MongoDB.

· 52CE 我爱测

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 d…

问题原文

原帖链接 · B14D3 · CC BY-SA 4.0

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 ?

已采纳解答

原帖链接 · Andrada · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-07-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。