Backup seafile server (redundancy) - suggestions?

993 views
Skip to first unread message

Trond Berglie

unread,
Nov 25, 2014, 1:03:32 PM11/25/14
to sea...@googlegroups.com
I am thinking about using Seafile as primary self-hosted solution (used OwnCoud). 
OwnCloud stored files as-is, but as I've found out, Seafile store files in blocks.

I have a backup providor i'd like to use to backup all data on Seafile to.
That way I have redundancy if somethings happens to my home-server.

My backup providor currently only support windows, so I have to do something like:

Hook up a virtual windows machine to the NFS/SMB share that seafile stores data on, and backup that directory directly.

Can I backup the /storage folder only? or what folder(s) do I need backup of?

Suggestions much appreciated :) 

Pascal Michard

unread,
Nov 25, 2014, 1:25:55 PM11/25/14
to sea...@googlegroups.com
you need to backup the databes as well. Have a look here: http://manual.seafile.com/maintain/backup_recovery.html

Pascal Michard

unread,
Nov 27, 2014, 7:45:29 PM11/27/14
to sea...@googlegroups.com
A Backupscript could look like this, (@devs: feel free to add it to the wiki if you like):
be aware of the --delete option of rsync. If you run the garbage collector, the deleted files will be deleted in the backup as well. After running garbage collector check if the system is running fine bevor running the backupscript, or remove the --delete option if you don't need it. I prefer to safe some space.
A little bit more complex but really great is rsnapshot. With rsnapshot you can define daily and weekly backups, so f.e. keeping backups of the last 5 days and the last 2 weeks.

#!/bin/bash
#
# Folder Structure:
# ->backup
# -> seafile // Installation folder
# -> seafile-data // Storage folder
# -> databases // databases
# -> latest
# -> outdated
#
#
## Backup Database

echo "mysql-Databases backup running"

# move last backup in outdated folder
mv /backup/database/latest/* /backup/database/outdated

mysqldump -h [mysqlhost] -u[username] -p[password] --opt ccnet-db > /backup/databases/latest/ccnet-db.sql.`date +"%Y-%m-%d-%H-%M-%S"`
mysqldump -h [mysqlhost] -u[username] -p[password] --opt seafile-db > /backup/databases/latest/seafile-db.sql.`date +"%Y-%m-%d-%H-%M-%S"`
mysqldump -h [mysqlhost] -u[username] -p[password] --opt seahub-db > /backup/databases/latest/seahub-db.sql.`date +"%Y-%m-%d-%H-%M-%S"`



## Backup Files
echo "Files backup running"

rsync -aW --no-compress --delete [path to seafile install folder]/ /backup/seafile_backup/seafile
## use the following line if you moved the seafile-data folder out of the install folder
#rsync -aW --no-compress --delete [path to seafile data folder]/ /backup/seafile_backup/seafile-data 

## send email f.e. with gmail

sendemail -f [gmail adress] -t [gmail adress] -u Backup -m "Seafile backup is done" -s smtp.gmail.com -o tls=yes -xu [gmail adress] -xp [gmail password] 

exit 0

Reply all
Reply to author
Forward
0 new messages