1

I'm playing around with sharded cluster and I'm thought I saw somewhere that different mongo version could live within the same cluster.

For example :

mongos : 4.0 configRs : 4.0 shardRs01 : 3.4 shardRs02 : 4.0

It would have saved me a lot of time because I would have migrated my shardRs01 to 4.0 (and debian 9) by simply moving the chunks to the rest of the cluster and deleting it once done.

But after thinking about it, it seemed strange that it could be possible, due to the compatibility issue between mongo versions.

And my tests are supporting this conclusion :

I cannot add a 3.4 shard into a 4.0 cluster Reversely I cannot add a 4.0 shard into a 3.6 cluster

So I wanted to make sure that it was the case that It is not possible to add a shard that does not use the same mongo version as the cluster.

1

It is possible to mix versions from adjacent major MongoDB server releases (for example: 3.6 and 4.0) for the purposes of upgrading, but in general a cluster should have consistent versions. Successive server versions are expected to add new features (additional data types, authentication mechanisms, protocol improvements, new commands, ...) that do not necessarily interoperate with every prior release. Upgrade steps and compatibility details are included in the release notes in the MongoDB documentation.

As part of the upgrade process for MongoDB 3.4+ there is now an intentional step of setting a Feature Compatibility Version (FCV) to toggle features that persist incompatible data changes while an upgrade is in progress. If you started with a MongoDB 4.0 deployment (rather than upgrading from a prior version), new 4.0 features will be enabled by default.

I highly recommend matching your mongo shell and command line tools with the version of your MongoDB server, and checking the compatibility for your driver.

I cannot add a 3.4 shard into a 4.0 cluster

Correct. If the 3.4 deployment is currently an independent replica set, it would have to be upgraded to MongoDB 3.6 and then upgraded to MongoDB 4.0 before adding to a 4.0 sharded cluster.

If you were starting with a 3.4 sharded cluster, all components of the cluster would have to be upgraded to MongoDB 3.6 (including setting FCV to 3.6) before continuing with the upgrade to MongoDB 4.0.

Reversely I cannot add a 4.0 shard into a 3.6 cluster

In theory you could downgrade a 4.0 replica set if you want to add it to a 3.6 cluster, but this is more challenging than upgrading. Any backwards incompatible data that has been persisted would have to be removed or updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.