maxpert / marmot

A distributed SQLite replicator built on top of NATS
https://maxpert.github.io/marmot/
MIT License
1.86k stars 42 forks source link

Supercluster nats setup for multi data center #110

Open gedw99 opened 6 months ago

gedw99 commented 6 months ago

I need to adjust the nats Jetstream code so it supports gateways and super clusters. This will allow replication between all you data centers globally without by data sync clashes.

https://docs.nats.io/running-a-nats-service/configuration/gateways

then , it’s just a matter of changing the config

https://docs.nats.io/running-a-nats-service/configuration/gateways/gateway

impacts

Users will tend to hit their closest data centre, and so we will not have issues with eventually consistency of mutations hitting Sqlite DB. So all good.

example

Adjust the Pocketbase example to use this, and then test using HTTP calls from many POPS ( points of presence, and then check DB consistency globally.

extra

Logging to NATS would make doing this type of work way way easier, and we have nats embedded anyway. Then from the NATS CLI you can see exactly what is going on.

https://github.com/synadia-io/rethink_connectivity/blob/main/17-microservices-architectures/slog.go has a great example and video showing how easy this is.

Need to add NATS Cli to the setup script too

PB also has a global logging feature too.