このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
50_dialy:2024:10:04 [2024/10/04 02:28] – matsui | 50_dialy:2024:10:04 [2024/10/04 03:35] (現在) – matsui | ||
---|---|---|---|
行 10: | 行 10: | ||
下記のサーバで、/ | 下記のサーバで、/ | ||
- | Aサーバ: 192.168.10.11 | + | |
- | Bサーバ: 192.168.10.12 | + | |
+ | Bサーバ: 192.168.10.12 | ||
==== 1. インストール ==== | ==== 1. インストール ==== | ||
行 17: | 行 18: | ||
sudo apt update | sudo apt update | ||
sudo apt install lsyncd | sudo apt install lsyncd | ||
+ | </ | ||
+ | |||
+ | ==== 2.両サーバへ鍵でSSH可能に ==== | ||
+ | |||
+ | < | ||
+ | ssh-copy-id root@192.168.10.12 | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ssh-copy-id root@192.168.10.11 | ||
+ | </ | ||
+ | |||
+ | ==== 3.lsyncd.conf.lua ==== | ||
+ | |||
+ | < | ||
+ | settings { | ||
+ | logfile | ||
+ | statusFile = "/ | ||
+ | statusInterval = 1, -- ステータスログの更新間隔を1秒に設定 | ||
+ | inotifyMode = " | ||
+ | } | ||
+ | |||
+ | sync { | ||
+ | default.rsyncssh, | ||
+ | source = "/ | ||
+ | host = " | ||
+ | targetdir = "/ | ||
+ | delay = 1, -- 変更後1秒で同期 | ||
+ | rsync = { | ||
+ | archive = true, | ||
+ | compress = true, | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | settings { | ||
+ | logfile | ||
+ | statusFile = "/ | ||
+ | statusInterval = 1, -- ステータスログの更新間隔を1秒に設定 | ||
+ | inotifyMode = " | ||
+ | } | ||
+ | |||
+ | sync { | ||
+ | default.rsyncssh, | ||
+ | source = "/ | ||
+ | host = " | ||
+ | targetdir = "/ | ||
+ | delay = 1, -- 変更後1秒で同期 | ||
+ | rsync = { | ||
+ | archive = true, | ||
+ | compress = true, | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== 4.起動と自動起動設定 ==== | ||
+ | |||
+ | < | ||
+ | sudo systemctl start lsyncd | ||
+ | sudo systemctl enable lsyncd | ||
</ | </ | ||
{{tag> | {{tag> |