mongo replica set between local server and public server

493 views Asked by At

Here is my situation:

I have a public server which allow users access from the internet, but the data is stored in a local computer. This computer can normally also connect to internet, but when the local system's internet connection is down I want to make sure I can run my local system well. So I want to configure a replica set between the public server and the local server; but the local server has no fixed internet IP address.

Here is my question:

How can I achieve my goal, to set up MongoDB on a local server and a public server, and sync data between these servers.

1

There are 1 answers

0
Vince Bowdren On

There are severe obstacles to building this kind of system:

  1. If the local server does not have a fixed ip address or name, then it is not possible to configure a node there; the replica set system assumes that each node can be consistently addressable.
  2. If you fixed the addressing problem and configured a 2-node replica set, it would not be resilient to a network outage so you could not carry on working on the local server. With only two nodes, if they lose connectivity then neither node carries a majority/consensus, so neither could become primary - and your replica set can no longer accept writes.