![Debian と TrueNAS 間の rsync の奇妙な動作](https://rvso.com/image/770118/Debian%20%E3%81%A8%20TrueNAS%20%E9%96%93%E3%81%AE%20rsync%20%E3%81%AE%E5%A5%87%E5%A6%99%E3%81%AA%E5%8B%95%E4%BD%9C.png)
rsync を使用して、Web サーバーから Truenas にデータをバックアップします。Web サーバーは Debian 11 を実行しており、Truenas は 12.0-U5 です。バックアップは、restic を使用して暗号化された形式で Web サーバーに保存されます。すでに暗号化されているため、ssh のオーバーヘッドを回避するために rsync を直接使用したいと思います。
Debianではrsyncのバージョンは3.2.3で、Truenasでは3.1.3です。
rsync -rdt rsync://rsync@truenas
時々ピアによって接続がリセットされる
rsync: [Receiver] safe_read failed to read 1 bytes: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(276) [Receiver=3.2.3]
これが 3 回、4 回、または 5 回繰り返されると、転送が機能します。
rsync -rdt rsync://rsync@truenas
web_backup
db_backup
何が起こるか見るために tcpdump を起動しました。クライアントは常に同じ文字列を送信しますが、truenas の rsync は時々応答し、時々接続をリセットします ([R] フラグ):
転送成功:
12:26:44.035035 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 66)
truenas.873 > webserver.58482: Flags [P.], cksum 0x2e81 (correct), seq 1:15, ack 15, win 1027, options [nop,nop,TS val 2820912976 ecr 2728215840], length 14
E..B..@[email protected]...:.c...........
.#.P..E @RSYNCD: 31.0
12:26:44.035098 IP (tos 0x0, ttl 63, id 53872, offset 0, flags [DF], proto TCP (6), length 52)
webserver.58482 > truenas.873: Flags [.], cksum 0xd829 (correct), ack 15, win 502, options [nop,nop,TS val 2728215841 ecr 2820912976], length 0
E..4.p@.?.....n......r.i.:.c.y.......).....
..E!.#.P
12:26:44.035127 IP (tos 0x0, ttl 63, id 53873, offset 0, flags [DF], proto TCP (6), length 53)
webserver.58482 > truenas.873: Flags [P.], cksum 0xce20 (correct), seq 15:16, ack 15, win 502, options [nop,nop,TS val 2728215841 ecr 2820912976], length 1
E..5.q@.?.....n......r.i.:.c.y....... .....
..E!.#.P
12:26:44.035218 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 69)
truenas.873 > webserver.58482: Flags [P.], cksum 0x56b7 (correct), seq 15:32, ack 16, win 1027, options [nop,nop,TS val 2820912976 ecr 2728215841], length 17
E..E..@[email protected]...:.d....V......
.#.P..E!web_backup
12:26:44.035226 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 83)
truenas.873 > webserver.58482: Flags [FP.], cksum 0xa8e8 (correct), seq 32:63, ack 16, win 1027, options [nop,nop,TS val 2820912976 ecr 2728215841], length 31
E..S..@.@..?......n..i.r.y.!.:.d...........
.#.P..E!db_backup
@RSYNCD: EXIT
転送に失敗しました:
12:26:50.724628 IP (tos 0x0, ttl 63, id 469, offset 0, flags [DF], proto TCP (6), length 66)
webserver.58532 > truenas.873: Flags [P.], cksum 0x98eb (correct), seq 1:15, ack 1, win 502, options [nop,nop,TS val 2728222530 ecr 633812564], length 14
E..B..@.?..{..n........iB.'.M..............
.._B%.6T@RSYNCD: 31.0
12:26:50.724972 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
truenas.873 > webserver.58532: Flags [R], cksum 0x43ae (correct), seq 1292349879, win 0, length 0
E..(..@[email protected].........
12:26:50.725398 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 66)
truenas.873 > webserver.58532: Flags [P.], cksum 0x96d0 (correct), seq 1:15, ack 15, win 1027, options [nop,nop,TS val 633812564 ecr 2728222530], length 14
E..B..@[email protected].'............
%.6T.._B@RSYNCD: 31.0
12:26:50.725470 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto TCP (6), length 40)
webserver.58532 > truenas.873: Flags [R], cksum 0xd85b (correct), seq 1123821333, win 0, length 0
E..(..@.?..j..n........iB.'.....P....[..
Truenas ログには他に何も表示されません:
Sep 3 12:26:44 truenas 1 2021-09-03T12:26:44.030844+02:00 truenas.local rsyncd 10028 - - connect from UNDETERMINED (webserver)
Sep 3 12:26:44 truenas 1 2021-09-03T12:26:44.031075+02:00 truenas.local rsyncd 10028 - - module-list request from UNDETERMINED (webserver)
Sep 3 12:26:50 truenas 1 2021-09-03T12:26:50.721209+02:00 truenas.local rsyncd 10032 - - connect from UNDETERMINED (webserver)
Sep 3 12:26:50 truenas 1 2021-09-03T12:26:50.721447+02:00 truenas.local rsyncd 10032 - - rsync: safe_read failed to read 1 bytes [Receiver]: Connection reset by peer (54)
Sep 3 12:26:50 truenas 1 2021-09-03T12:26:50.721476+02:00 truenas.local rsyncd 10032 - - rsync error: error in rsync protocol data stream (code 12) at io.c(276) [Receiver=3.1.3]
ここで何が起こっているのですか?
答え1
Debianでrsyncの古いバージョンを使ってみてください(オールドステーブル)。TrueNAS-13.1-RELEASE は rsync バージョン 3.1.3 プロトコル バージョン 31 を使用するためです。どうやらFreeBSD ACLサポートが動作する最新バージョン(202112)。また、rsync の現在の問題とデバッグ。