「Backup」:修訂間差異
跳至導覽
跳至搜尋
第27行: | 第27行: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
在<code>~/.my.cnf</code>內可以: | 在<code>~/.my.cnf</code>內可以設定: | ||
<syntaxhighlight lang="ini"> | <syntaxhighlight lang="ini"> |
於 2025年3月30日 (日) 03:21 的修訂
這邊會有備份(英語:Backup)的一些資料。
範例
這邊是利用restic備份到B2上面,需要先初始化restic的設定(這篇沒有):
#!/bin/bash
umask 077
export B2_ACCOUNT_ID="x"
export B2_ACCOUNT_KEY="x"
export RESTIC_PASSWORD="x"
# Directory
sudo tar cf - /srv/foo | zstd -19 -cf -T0 -o /tmp/foo.tar.zst --rsyncable
restic -r b2:gslin-backup-kennel backup /tmp/foo.tar.zst
# MySQL
mysqldump foo | zstd -19 -cf -T0 -o /tmp/foo-mysql.tar.zst --rsyncable
restic -r b2:gslin-backup-kennel backup /tmp/foo-mysql.tar.zst
# Prune
restic -r b2:gslin-backup-bucket forget --keep-daily=7 --keep-weekly=4 --keep-monthly=3 --keep-yearly=3
restic -r b2:gslin-backup-bucket prune
在~/.my.cnf
內可以設定:
[client]
user=readonly
password=x