mirror of
https://github.com/haiwen/seafile-admin-docs.git
synced 2025-12-26 02:32:50 +00:00
Merge pull request #20 from bish0polis/patch-1
correct English in real-time backup instructions
This commit is contained in:
commit
df08b1d228
|
|
@ -14,26 +14,26 @@ The real-time backup server uses a syncing algorithm similar to the Seafile desk
|
|||
- The backup server always keep the database and data directory consistent. So no libraries on the backup server will be in corrupted state (unless they're already corrupted on the primary server).
|
||||
- The full history of all libraries will be backed up. This is not like the desktop client, which only syncs the latest state of a library.
|
||||
|
||||
There are two sets of data that need to be backup:
|
||||
There are two sets of data that need to be backed up:
|
||||
|
||||
- The seafile-data directory and the core library metadata tables in the seafile database. This data is the core data structures of the libraries in Seafile. They're synced to the backup server with Seafile's syncing algorithm. In this procedure, the metadata tables are kept consistent with the seafile-data directory.
|
||||
- All other tables in the database (including seafile, ccnet and seahub databases) are backup with mysqldump. mysqldump can't backup the database in real time. You can setup a crontab for mysqldump at regular intervals. The latency of backup for these tables doesn't affect the integrity of library data.
|
||||
- All other tables in the database (including seafile, ccnet and seahub databases) are backed up with mysqldump. mysqldump can't back up the database in real time. You can setup a crontab for mysqldump at regular intervals. The latency of backup for these tables doesn't affect the integrity of library data.
|
||||
|
||||
In the following discussion, we'll use "primary server" and "master server", "backup server" and "slave server" interchangeably.
|
||||
|
||||
## Configure Real-Time Backup Server
|
||||
|
||||
We assume you already have a primary server running, and now you want to setup a backup server.
|
||||
We assume you already have a primary server running, and now you want to set up a backup server.
|
||||
|
||||
The steps to setup the backup server are:
|
||||
|
||||
1. Install Seafile on the backup server
|
||||
2. Configure Seafile syncing between the primary server and the backup server
|
||||
3. Backup the tables in the database by `mysqldump` at regular intervals
|
||||
3. Back up the tables in the database by `mysqldump` at regular intervals
|
||||
|
||||
### Install Seafile on the Backup Server
|
||||
|
||||
You should install Seafile Pro Edition on the backup server according to [this documentation](../deploy_pro/download_and_setup_seafile_professional_server.md). Since the real-time backup feature is only available for 5.1.0 or later, you also have to upgrade your primary server to 5.1.0 version or later.
|
||||
You should install Seafile Pro Edition on the backup server according to [this documentation](../deploy_pro/download_and_setup_seafile_professional_server.md). Since the real-time backup feature is only available for 5.1.0 or later, you also have to upgrade your primary server to version 5.1.0 or later.
|
||||
|
||||
When installing Seafile on the backup server, you have to notice:
|
||||
|
||||
|
|
@ -60,18 +60,18 @@ sync_token = c7a78c0210c2470e14a20a8244562ab8ad509734
|
|||
sync_poll_interval = 3
|
||||
```
|
||||
|
||||
- `backup_url`: the backup server's address in url format. You can use http or https.
|
||||
- `backup_url`: the backup server's address in url format. You can use HTTP or HTTPS.
|
||||
- `primary_url`: the primary server's address in url format.
|
||||
- `sync_token`: a secret that shared between the primary and backup server. It's 40 character SHA1 generated by the system admin. You can use `uuidgen | openssl sha1` command to generate a random token.
|
||||
- `sync_poll_interval`: The backup server polls all libraries of the primary server periodically. You can set the poll interval in the unit of hours. The default interval is 1 hour, which mean the backup server will poll the primary every hour. You should choose larger intervals if you have large number of libraries.
|
||||
- `sync_token`: a secret shared between the primary and backup server. It's a 40 character SHA1 token generated by the system admin. You can use `uuidgen | openssl sha1` command to generate a random token.
|
||||
- `sync_poll_interval`: The backup server polls all libraries of the primary server periodically. You can set the poll interval in units of hours. The default interval is 1 hour, which means the backup server will poll the primary every hour. You should choose larger intervals if you have larger libraries.
|
||||
|
||||
If you use https to sync between primary and backup servers, you have to use the correct Seafile server package for your system. If you run CentOS, you should use the Seafile package named without "Ubuntu" suffix; if you run Debian or Ubuntu, you should use the Seafile package named with "Ubuntu" suffix. Otherwise you may meet CA error in https requests.
|
||||
If you use HTTPS to sync between primary and backup servers, you must use the correct Seafile server package for your system. If you run CentOS, you should use the Seafile package named without the "Ubuntu" suffix; if you run Debian or Ubuntu, you should use the Seafile package named with "Ubuntu" suffix. Otherwise you may meet CA errors in HTTPS requests.
|
||||
|
||||
After saving the configuration, restart seafile service on the primary and backup servers. The backup server will automatically start backup on restart.
|
||||
After saving the configuration, restart the seafile service on the primary and backup servers. The backup server will automatically start backing up on restart.
|
||||
|
||||
**Note**: Don't start the seahub progress on the Seafile backup server.
|
||||
|
||||
### Backup the Databases
|
||||
### Back up the Databases
|
||||
|
||||
Backup data from the databases on the primary server's MySQL with mysqldump:
|
||||
|
||||
|
|
@ -85,19 +85,19 @@ mysqldump -u <user> -p<password> --databases \
|
|||
|
||||
You should replace `<user>`, `<password>` with your MySQL admin user and password. You should replace `<seafile_db>`, `<seahub_db>` and `<ccnet_db>` with your database names.
|
||||
|
||||
The three ignored tables are core tables related to library data and are synced by Seafile backup server in a real-time manner. They're kept in the seafile database of the backup server and are separated from the mysqldump process.
|
||||
The three ignored tables are core tables related to library data, and are synced by Seafile backup server in a real-time manner. They're kept in the seafile database of the backup server and are separated from the mysqldump process.
|
||||
|
||||
**You should setup crontab to run the mysqldump at regular intervals.**
|
||||
**You should set up crontab to run the mysqldump at regular intervals.**
|
||||
|
||||
If you want to backup the tables (except for the 3 tables synced by Seafile) in a more real-time manner, you can deploy the master-slave replication for the MySQL/MariaDB database from the primary node to another database server. **The database running on the backup server must not be used as the target of this replication.** Otherwise you'll end up with replication conflicts, since the db on backup server will also be updated by Seafile backup process too.
|
||||
If you want to back up the tables (except for the 3 tables synced by Seafile) in a more real-time manner, you can deploy the master-slave replication for the MySQL/MariaDB database from the primary node to another database server. **The database running on the backup server must not be used as the target of this replication.** Otherwise you'll end up with replication conflicts, since the db on backup server will also be updated by Seafile backup process too.
|
||||
|
||||
### Checking Backup Status
|
||||
|
||||
After the above setup, you should now have the below layout of your backup data:
|
||||
|
||||
* Library data is backed up and managed by Seafile backup server. The data can be stored on external storage, object storage, or local disk, depending on your setup for the backup server.
|
||||
* Database tables are splited into two parts:
|
||||
* 3 core library tables are backup in real-time to the backup node's MySQL database.
|
||||
* Database tables are split into two parts:
|
||||
* 3 core library tables are backed up in real-time to the backup node's MySQL database.
|
||||
* Other tables are regularly dumped to a file with mysqldump. The backup files are stored somewhere other than the primary server.
|
||||
|
||||
`seaf-backup-cmd.sh` provides `status` command to view the backup status. The output is like:
|
||||
|
|
@ -119,23 +119,23 @@ xxx
|
|||
xxx
|
||||
```
|
||||
|
||||
There are a few reasons that may fail the backup of a library:
|
||||
There are a few reasons the backup of a library may fail:
|
||||
|
||||
- Some data in the primary server is corrupted. The data may be in the latest state or in history. Since the backup procedure syncs the full history, corruption in history will fail the backup.
|
||||
- The primary server has run seaf-fsck, which may restore a library back to an older state.
|
||||
|
||||
## Restore from the Backup Server
|
||||
|
||||
In the unfortunate situation of severe data corruptoin happens on the primary server, you can restore your service quickly directly on the backup server. The recovered service can directly be run on the backup server.
|
||||
In the unfortunate situation where severe data corruption happens on the primary server, you can restore your service quickly directly on the backup server. The recovered service can be run directly on the backup server.
|
||||
|
||||
There are tow steps to restore on the backup server:
|
||||
|
||||
- Import the latest mysql dump file into the Seafile backup server's MySQL database.
|
||||
- Import the latest MySQL dump file into the Seafile backup server's MySQL database.
|
||||
- Enable other Pro features on the Seafile backup server, and start seahub progress `./seahub.sh start`.
|
||||
|
||||
#### Step1: Import mysql dump file into backup server
|
||||
#### Step1: Import MySQL dump file into backup server
|
||||
|
||||
Importing the latest mysql dump file into the backup server's database:
|
||||
Importing the latest MySQL dump file into the backup server's database:
|
||||
|
||||
```
|
||||
mysql -u <user> -p<pass> < dbdump.sql
|
||||
|
|
|
|||
Loading…
Reference in New Issue