lipkowski.be #ID27

Datenschutzerklaerung Impressum

Suche mit Qwant
Nur lipkowski.be durchsuchen

#ID27 2016-04-26 17:35:19 [HOME]
SQLite Replication auf einem raspbian 7 wheezy einrichten


Heute habe ich auf meinem PI Server eine SQLite Replication für meine Datenbanken eingerichtet.


Dafür habe ich das Script
inosync.py

verwendet. Um über RSYNC und SSH ein Backup meiner SQLite Datenbanken zu realisieren.

Hierfür bin ich wie folgt vorgegangen:

- Update raspbian
apt-get update

- Abhängigkeiten installieren
apt-get install python-pyinotify rsync

- 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/master/sample_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)
update-rc.d cron defaults
crontab -e
######
@reboot /usr/bin/inosync.py -d -c /etc/inosynccfg.py
######





#lipkowski.be #lipkowski-be #lipkowskibe