database replication on different machines
1- I want to create mongodb replication. how can I create 2 linodes on same datacentre but different machines so that if there is problem in one machine, other machine will still be working.
2- Is this practical to create replicas on different datacentres?
Replication Sets Within Same DC
Whenever you deploy servers our allocator will automatically avoid placing more than one of your servers on the same host, if availability allows. Once you have your servers set up you can reach out to us through a ticket and we can confirm that they're on separate hosts.
Instructions for how to carry this out can be found here: How to Create a MongoDB Replica Set
Replication Sets Across Different DCs
The practicality of this really depends on your needs. The purpose of this setup is to protect yourself against events that affect the entire DC, like natural disasters or network interruptions. If you're not comfortable with the risk of that, then definitely set this up for yourself. If you're OK with these odds, then I think it would be more efficient to keep your replicas in the same DC to reduce latency and allow them to communicate over the intra-DC private network.
More context surrounding this can be found here: Replica Sets Distributed Across Two or More Data Centers