Update SYNC_SETUP.md to include gt3.ivx.su as a new replica server for config.toml synchronization. Adjust instructions for preparing B servers and initial synchronization to reflect the addition of the new server.
Publish telemt-bot Docker image / build-and-push (push) Successful in 27s
Publish telemt-bot Docker image / build-and-push (push) Successful in 27s
This commit is contained in:
+38
-8
@@ -1,12 +1,12 @@
|
||||
# Синхронизация `config.toml` между `mtg.ivx.su`, `gt1.ivx.su` и `gt2.ivx.su`
|
||||
# Синхронизация `config.toml` между `mtg.ivx.su`, `gt1.ivx.su`, `gt2.ivx.su` и `gt3.ivx.su`
|
||||
|
||||
Целевая схема:
|
||||
- **A (primary, запись):** `mtg.ivx.su`
|
||||
- **B (replica, только чтение):** `gt1.ivx.su`, `gt2.ivx.su`
|
||||
- **B (replica, только чтение):** `gt1.ivx.su`, `gt2.ivx.su`, `gt3.ivx.su`
|
||||
|
||||
Изменения вносятся только на A (через API/бот), затем автоматически синхронизируются на оба B.
|
||||
Изменения вносятся только на A (через API/бот), затем автоматически синхронизируются на все B.
|
||||
|
||||
## 1) Подготовка `telemt-data` на обоих серверах
|
||||
## 1) Подготовка `telemt-data` на каждом B-сервере
|
||||
|
||||
```bash
|
||||
cd /opt/telemt-plus
|
||||
@@ -58,7 +58,7 @@ enabled = true
|
||||
read_only = false
|
||||
```
|
||||
|
||||
### B (`gt1.ivx.su`, `gt2.ivx.su`)
|
||||
### B (`gt1.ivx.su`, `gt2.ivx.su`, `gt3.ivx.su`)
|
||||
|
||||
```toml
|
||||
[server.api]
|
||||
@@ -74,8 +74,10 @@ read_only = true
|
||||
ssh-keygen -t ed25519 -N "" -f ~/.ssh/telemt_sync
|
||||
ssh-copy-id -i ~/.ssh/telemt_sync.pub [email protected]
|
||||
ssh-copy-id -i ~/.ssh/telemt_sync.pub [email protected]
|
||||
ssh-copy-id -i ~/.ssh/telemt_sync.pub [email protected]
|
||||
ssh -i ~/.ssh/telemt_sync [email protected] "echo ok"
|
||||
ssh -i ~/.ssh/telemt_sync [email protected] "echo ok"
|
||||
ssh -i ~/.ssh/telemt_sync [email protected] "echo ok"
|
||||
```
|
||||
|
||||
## 5) Установка `lsyncd` на A (`mtg.ivx.su`)
|
||||
@@ -133,11 +135,31 @@ sync {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- B3: gt3.ivx.su
|
||||
sync {
|
||||
default.rsyncssh,
|
||||
source = "/opt/telemt-plus/telemt-data/",
|
||||
host = "[email protected]",
|
||||
targetdir = "/opt/telemt-plus/telemt-data/",
|
||||
delay = 1,
|
||||
exclude = { "cache/" },
|
||||
rsync = {
|
||||
archive = true,
|
||||
compress = true,
|
||||
_extra = {
|
||||
"--delete",
|
||||
"--chown=999:999",
|
||||
"--chmod=Du=rwx,Dg=rx,Do=,Fu=rw,Fg=r,Fo=",
|
||||
"-e", "ssh -i /root/.ssh/telemt_sync -o StrictHostKeyChecking=accept-new"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 6) Первичная синхронизация (один раз)
|
||||
|
||||
**Важно:** на каждом B (`gt1.ivx.su`, `gt2.ivx.su`) должен быть установлен `rsync`:
|
||||
**Важно:** на каждом B (`gt1.ivx.su`, `gt2.ivx.su`, `gt3.ivx.su`) должен быть установлен `rsync`:
|
||||
|
||||
```bash
|
||||
# Выполнить на каждом B-сервере:
|
||||
@@ -162,6 +184,14 @@ rsync -az --delete \
|
||||
-e "ssh -i /root/.ssh/telemt_sync -o StrictHostKeyChecking=accept-new" \
|
||||
/opt/telemt-plus/telemt-data/ \
|
||||
[email protected]:/opt/telemt-plus/telemt-data/
|
||||
|
||||
# B3: gt3.ivx.su
|
||||
rsync -az --delete \
|
||||
--chown=999:999 \
|
||||
--chmod=Du=rwx,Dg=rx,Do=,Fu=rw,Fg=r,Fo= \
|
||||
-e "ssh -i /root/.ssh/telemt_sync -o StrictHostKeyChecking=accept-new" \
|
||||
/opt/telemt-plus/telemt-data/ \
|
||||
[email protected]:/opt/telemt-plus/telemt-data/
|
||||
```
|
||||
|
||||
## 7) Запуск `lsyncd`
|
||||
@@ -182,7 +212,7 @@ systemctl cat lsyncd
|
||||
|
||||
## 8) Проверка работы
|
||||
|
||||
На обоих серверах:
|
||||
На каждом B (`gt1.ivx.su`, `gt2.ivx.su`, `gt3.ivx.su`):
|
||||
|
||||
```bash
|
||||
cd /opt/telemt-plus
|
||||
@@ -202,4 +232,4 @@ curl -s http://127.0.0.1:9091/v1/health
|
||||
|
||||
- Мутации (`POST/PATCH/DELETE`) делать только на A (`mtg.ivx.su`).
|
||||
- Бота направлять на API A.
|
||||
- B (`gt1.ivx.su`, `gt2.ivx.su`) держать как реплики только для чтения.
|
||||
- B (`gt1.ivx.su`, `gt2.ivx.su`, `gt3.ivx.su`) держать как реплики только для чтения.
|
||||
|
||||
Reference in New Issue
Block a user