Heute habe ich auf meinem PI Server eine SQLite Replication eingerichtet.
Hierfür habe ich das Script
inosync.py
verwendet. Um über RSYNC und SSH ein Backup meiner SQLite Datenbanken zu realisieren.
Ich bin wie folgt vorgegangen:
- Update raspbian
apt-get update
- Abhängigkeiten installieren
apt-get install rsync python-pyinotify
- Script runterladen
wget "https://raw.githubusercontent.com/hollow/inosync/master/inosync.py" -O /usr/bin/inosync.py
- Script ausführbar machen
chmod +x /usr/bin/inosync.py
- Beispielconfig runterladen
wget "https://raw.githubusercontent.com/hollow/inosync…ample_config.py" -O /etc/inosynccfg.py
- Config editieren
vim /etc/inosynccfg.py
###########
# array of directories that should be watched for changes
wpaths = ["/var/sqlite/"]
# exclude list for rsynic
rexcludes = [
"/localhost",
]
# rpaths has one-to-one correspondence with wpaths for syncing multiple directories
rpaths = ["/home/ba/var/sqlite/"]
# remote locations in rsync syntax
rnodes = [
"ba@lipkowski.cz:",
]
# extra, raw parameters to rsync
extra = "--rsh='ssh -a'"
# limit remote sync speed (in KB/s, 0 = no limit)
#rspeed = 0
# event mask (only sync on these events)
#emask = [
# "IN_CLOSE_WRITE",
# "IN_CREATE",
# "IN_DELETE",
# "IN_MOVED_FROM",
# "IN_MOVED_TO",
#]
# event delay in seconds (this prevents huge
# amounts of syncs, but dicreases the
# realtime side of things)
#edelay = 10
# rsync binary path
#rsync = "/usr/bin/rsync"
###########
- Replication testen ([STRG] + [C] zum abbrechen)
/usr/bin/inosync.py -c /etc/inosynccfg.py
- Replication als Daemon starten
/usr/bin/inosync.py -d -c /etc/inosynccfg.py
- Replication beim starten aktivieren (ich verwendet hierfür cron)
crontab -e
######
@reboot /usr/bin/inosync.py -d -c /etc/inosynccfg.py
######
Ich hoffe das ist soweit verständlich
Deeplink https://www.lipkowski.zone/z/lipkowski.zo…amp;brain_id=27