I am currently trying to get mongodb transactions working in our project. We currently have only have one server.
Is it a good idea to run 3 containers for a replica set on the same server? Or would it be better to run only one container as a single member replica set?
Thanks
There is no benefit to running multiple MongoDB nodes on the same server, and there are severe downsides.
The point of a replica set is to provided redundancy, for example in the case of a hardware or networking failure. But if all three nodes are on the same server, then any such failure will affect all three at once - so this setup will fail to provide any redundancy.
The downsides: multiple MongoDB instances on the same server will run into memory conflicts, leading to performance problems.
If you want to use transactions, then you can set up a replica set with just one member. You don't get any benefits of redundancy or availability, but it will let you get started with transactions.