I'm creating self-hosted DNS-service, that can be run by any user on it's servers. The purpose is to parent-control of the available websites and block adverstments and phishing sites by publicly available lists. Service contain:
- dns server
- DoH bridge to make dns server work on android (as a private dns)
- Web interface to control what domains should be blocked, and to load blacklists.
The problem is: to make my DNS service more fail-tolerant, user should be able to install it on a multiple servers, vps-es and so on.
I want to make it so every node is self-sufficient, and, when user configure it's domain name (for example, dns.johndoe.me) to use multiple A-records (for multiple servers), he doesn't need any other actions, just open https://dns.johndoe.me and enter web interface to configure DNS blacklists and so on.
So I need the database to be synchronized in multi-master mode.
Requirements:
- Minimal possible configuration on the installation process, something simple as specifing IP address and exchanging authorization tokens (or even pass ports through ssh tunnels between hosts, and specify them)
- Key-value or SQL - any is good, because data structures to be stored is quite simple (user accounts, dns rules, blacklists)
- No fast synchronization is required. As I almost wouldn't have any real-time changing data, the lag in synchronization could be up to several seconds, and that would be good enough
- No transactions or locking is required
- Possible conflicts should be solved in a simple way: older change is used, other conflicts, as changing already deleted record just should be ignored
For this requirements I've did't find something good, because all the instructions in the internet is about requirements for something powerful, fast, durable and so on. I know how to configure patroni cluster on postgresql, but it's overkill for my task.
It'll be best to have some kind of Redis with multi-master synchronization, as it's simple and good enough for my task (but unfortunately where are no such thing as multi-master sync with redis)
Also, I've looked at mariadb multi-master replication, but so far I have not been able to deeply understand this, it looks rather complicated.
Update:
- Found KeyDB key-value database that is a replacement for redis with multi-master replication
- Found YugaByte DB which is postgresql-compatible database with multi-master replication
- Found LiteSync - proprietary library for sqlite database replication
- Found RqLite - simple distributed database server based on sqlite, and having DBAPI2.0 api for python
- Found Marmot - sqlite replicator based on NATS JetStreams
I'll continue to investigate this, until came to a best and simples solution. For now it looks like KeyDB should be the one