明日复明日,明日何其多。
我生待明日,万事成蹉跎。

nextcloud如何备份数据

Backup

To backup a Nextcloud installation there are four main things you need to retain:

  1. The config folder
  2. The data folder
  3. The theme folder
  4. The database

Maintenance mode

maintenance:mode locks the sessions of logged-in users and prevents new logins in order to prevent inconsistencies of your data. You must run occ as the HTTP user, like this example on Ubuntu Linux:

$ sudo -u www-data php occ maintenance:mode --on

You may also put your server into this mode by editing config/config.php. Change "maintenance" => false to "maintenance" => true:

<?php

 "maintenance" => true,

Don’t forget to change it back to false when you are finished.

Backup folders

Simply copy your config, data and theme folders (or even your whole Nextcloud install and data folder) to a place outside of your Nextcloud environment. You could use this command:

rsync -Aavx nextcloud/ nextcloud-dirbkp_`date +"%Y%m%d"`/

Backup database

Warning

Before restoring a backup see Restoring backup

MySQL/MariaDB

MySQL or MariaDB, which is a drop-in MySQL replacement, is the recommended database engine. To backup MySQL/MariaDB:

mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

SQLite

sqlite3 data/owncloud.db .dump > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

PostgreSQL

PGPASSWORD="password" pg_dump [db_name] -h [server] -U [username] -f nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

Next  Previous

赞(0) 打赏
未经允许不得转载:致明日 » nextcloud如何备份数据
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

坚持,总会看见蓝天和白云

联系我们你来了,你就是最棒的!

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏