Chained replication for a sharded atlas cluster

How do I turn on chained replication for a sharded atlas cluster? When I try to do it using mongosh I get an error like:

MongoServerError: not authorized on admin to execute command { replSetReconfig: { settings: { chainingAllowed: true }, version: 2, protocolVersion: 1 }, apiVersion: “1”, lsid: { id: UUID(“bc49573a-973d-425f-a795-6d2d1c42c80f”) }, $clusterTime: { clusterTime: Timestamp(1707461842, 28), signature: { hash: BinData(0, 89CF69C17010C34030A6100FB0B6F6B49E314850), keyId: 7328181429316091928 } }, $db: “admin” }

Hi @Rohan_Desai and welcome to the MongoDB Community.

The error looks as an access issue with the replica set.
Could you help me with the steps that you have been following to set the chainingAllowed value to true.?

Also, as mentioned in the documentation for replica set configuration,

Starting in MongoDB 5.0.2, 4.2.16, and 4.4.8:

Replica set secondary members can replicate data from other secondary members even if settings.chainingAllowed is false.

Could you also help me with the MongoDb version you are on?


Thanks for helping!

I am running a sharded atlas cluster at MongoDB version 6.0.13.

I’m trying to connect to one of the shards using a user with atlasAdmin to set the config:

$ mongosh "mongodb://" --ssl --apiVersion 1 --username soak-admin
Atlas atlas-pqaurr-shard-1 [direct: secondary] test> rs.reconfig({settings: {chainingAllowed : true}})

Also, as mentioned in the documentation for replica set configuration

Got it. From my replica set’s metrics it looks like both secondaries are replicating from the primary. Is there any way to get one of the secondaries to replicate from the other secondary? I want to do this to try to reduce the load on the primary.

Hi @Rohan_Desai

Apologies for writing late,

As mentioned in the above documentation:

Starting in MongoDB 5.0.2, 4.2.16, and 4.4.8:

Also, have you tried the steps mentioned to override the setting.chainingAllowed value?
If not, I would recommend following the steps and let us know if you facing the issue.