Hybrid MongoDB cluster and number of nodes

Dear all,

First post on these boards :slight_smile:

I’m rather new to MongoDB, so please bear with me.

I have two questions regarding MongoDB clusters:

1/ Are hybrid clusters possible (with nodes on both Linux and Windows servers) ?
2/ Is it possible to add extra nodes to an existing cluster without breaking anything (say going from 2 nodes to 3) ?

Best regards,

Samuel

1 Like

Hello @Samuel_VISCAPI, welcome to the MongoDB Community forum!

In MongoDB, a cluster can mean a replica-set or a sharded cluster. Since, you didn’t mention which one it is I am posting for a replica-set.

1/ Are hybrid clusters possible (with nodes on both Linux and Windows servers) ?

I think it is possible.

MongoDB uses statement based replication, and the write information is stored and replicated using an oplog. The requirement would be that all the nodes in the cluster must have the same MongoDB versions.


2/ Is it possible to add extra nodes to an existing cluster without breaking anything (say going from 2 nodes to 3) ?

It is possible - see Add Members to a Replica Set

2 Likes

Hi @Samuel_VISCAPI,

I hope you have got your doubt cleared.
If you still have any further questions feel free to mention them down here.

Thank you @Prasad_Saya for helping out.

Regards,
Kushagra

Hi @Prasad_Saya and @Kushagra_Kesav !

Thank you very much for the quick reply and the kind words, really appreciated :slight_smile:

I was indeed referring to a replica set, sorry I forgot to mention it. The third node on the Windows server would act as an arbiter only.

Best regards,

Samuel

1 Like

Hi @Samuel_VISCAPI,

  • Yes, the third one will be arbiter. The arbiter only votes in elections during the elections of the new primary.

Please feel free to reach out if you have any questions.

Happy Learning :clap:

Thanks,
Kushagra

Welcome to the MongoDB Community @Samuel_VISCAPI!

To provide more certainty to @Prasad_Saya’s answer: as long as you are using compatible server versions (ideally, identical) the replication protocol is cross-platform and a replica set can have members using different operating systems.

However, generally you would want data-bearing replica set members to have similar configurations so performance and failover is more predictable. Performance, security, and tuning will vary between operating systems on otherwise identical hardware.

Unfortunately this is inaccurate terminology. However I realise it is used in one of our MongoDB University courses and have raised an issue to review this usage.

The replication oplog records operations affecting data as ordered sequences of idempotent changes based on the original command and the affected documents. Oplog operations produce the same results whether applied once or multiple times to the target dataset, which would not be the case if the original statement was used. For example, a command deleting a range of documents (eg db.mydata.remove({expired: true}) will result in an oplog entry for every document deleted on the primary to ensure all members of the replica set apply identical changes.

I think it is important to call out this difference, as statement-based replication in the SQL world can lead to significant side effects (especially when stored procedures are involved). For some example caveats, see MySQL’s Advantages and Disadvantages of Statement-Based and Row-Based Replication.

A better description for MongoDB’s approach might be document-based replication, or perhaps logical replication (as opposed to physical). We need to agree on that when revising the course material :slight_smile: .

I recommend you avoid using an arbiter in a production environment with modern versions of MongoDB. Arbiters are not ideal (see my comment on Replica set with 3 DB Nodes and 1 Arbiter) and the operational consequences will be more disruptive with an active cluster.

Regards,
Stennie

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.