You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements automatic config synchronization from a master server to
one or more slave servers via rsync+SSH on a configurable interval.
Synced: secrets.conf, upstreams.conf, instances.conf, config.toml
Never synced: settings.conf, replication.conf (slave role preserved)
New CLI: mtproxymax replication [setup|status|add|remove|sync|test|
logs|promote|enable|disable|reset]
TUI: [r] Replication in main menu with full management interface.
Features:
- Configurable SSH user (REPLICATION_SSH_USER, default root)
- rsync --delete toggle (REPLICATION_DELETE_EXTRA)
- flock prevents overlapping sync runs
- Triple-layered exclude-list protection for slave identity
- SSH key auto-generation (ed25519) with TOFU warning
- Dependency checks for rsync/ssh/ssh-keygen
- Promote slave to master for failover
- 112 unit tests (no Docker/SSH required)
Closes#39
Copy file name to clipboardExpand all lines: README.md
+84-1Lines changed: 84 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,7 @@ Most MTProxy tools give you a proxy and a link. That's it. MTProxyMax gives you
40
40
41
41
- 🔐 **Multi-user secrets** with individual bandwidth quotas, device limits, and expiry dates
42
42
- 🤖 **Telegram bot** with 17 commands — manage everything from your phone
43
+
- 🗂️ **Replication** — sync config to slave servers automatically via rsync+SSH
43
44
- 🖥️ **Interactive TUI** — no need to memorize commands, menu-driven setup
44
45
- 📊 **Prometheus metrics** — real per-user traffic stats, not just iptables guesses
45
46
- 🔗 **Proxy chaining** — route through SOCKS5 upstreams for extra privacy
@@ -222,6 +223,47 @@ mtproxymax telegram setup
222
223
- 🟢 Proxy started → sends connection details + QR codes
223
224
- 📊 Periodic traffic reports at your chosen interval
224
225
226
+
---
227
+
228
+
### 🗂️ Replication (Master-Slave Config Sync)
229
+
230
+
Keep multiple proxy servers in sync automatically. The master pushes config changes to all slaves via rsync+SSH on a configurable interval. Slaves receive `secrets.conf`, `upstreams.conf`, `instances.conf`, and `config.toml` — their own role settings and local state are never overwritten.
231
+
232
+
**Setup takes two commands:**
233
+
234
+
```bash
235
+
# On master — run wizard, select Master, add slave
236
+
mtproxymax replication setup
237
+
238
+
# On slave — run wizard, select Slave
239
+
mtproxymax replication setup
240
+
```
241
+
242
+
**How it works:**
243
+
- Master generates a self-contained sync script at `/opt/mtproxymax/mtproxymax-sync.sh`
244
+
- A systemd timer fires every N seconds (default: 60) and runs the sync
245
+
- On change — proxy container on slave is automatically restarted
246
+
-`settings.conf` and `replication.conf` are always excluded — slave role is never overwritten
247
+
248
+
```bash
249
+
mtproxymax replication status # Show role, timer state, last sync
0 commit comments