Wiki source code of Backup and Restore
Last modified by Eleni Cojocariu-testing account on 2026/08/21 15:40
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | An XWiki instance keeps its data in several places, and a backup that misses one of them cannot bring the instance back. Where each part lives decides which tool copies it: | ||
| 2 | |||
| 3 | {{plantuml}} | ||
| 4 | @startuml | ||
| 5 | !theme bluegray | ||
| 6 | skinparam componentStyle rectangle | ||
| 7 | left to right direction | ||
| 8 | |||
| 9 | component "**Database**\nPages and their history, users,\nrights, Administration settings" as DB | ||
| 10 | component "**Permanent directory**\nattachments, installed extensions,\nsearch indexes, mail queue,\nand the HSQLDB database itself" as PERM | ||
| 11 | component "**Web application**\nxwiki.cfg, xwiki.properties,\nhibernate.cfg.xml, logback.xml,\nJDBC driver, filesystem skins" as WEBAPP | ||
| 12 | component "**Log files**\nwhat the instance was doing,\nno wiki data" as LOGS | ||
| 13 | |||
| 14 | component "**Backup**" as BACKUP | ||
| 15 | |||
| 16 | DB --> BACKUP : dump taken by the\ndatabase's own tool | ||
| 17 | PERM --> BACKUP : file copy, instance stopped | ||
| 18 | WEBAPP --> BACKUP : file copy | ||
| 19 | LOGS --> BACKUP : file copy, optional | ||
| 20 | @enduml | ||
| 21 | {{/plantuml}} | ||
| 22 | |||
| 23 | [[Back Up an XWiki Instance>>doc:documentation.xs.admin.backup.backup-instance.WebHome]] copies all of them and [[Restore an XWiki Instance>>doc:documentation.xs.admin.backup.restore-instance.WebHome]] puts them back, each using the command of your own database from [[Database Backup and Restore Commands>>doc:documentation.xs.admin.backup.database-commands.WebHome]]. [[Automate a Backup with a Shell Script>>doc:documentation.xs.admin.backup.automate-shell-script.WebHome]] turns that procedure into a job a scheduler can run every night. | ||
| 24 | |||
| 25 | Back up the database with the database's own tool rather than by exporting the wiki Pages, because an export holds neither the files nor the data the wiki keeps outside its Pages: [[XAR Export as a Backup Method>>doc:documentation.xs.admin.backup.xar-export.WebHome]]. | ||
| 26 | |||
| 27 | How often to back up follows from how much work you can afford to redo, so a wiki written to every day needs a daily backup. Two moments call for one whatever the schedule says: before an [[upgrade>>doc:documentation.xs.admin.upgrade.WebHome]], and before a change to the database or to the [[configuration>>doc:documentation.xs.admin.configuration.WebHome]] that you are not sure you can undo. | ||
| 28 | |||
| 29 | A backup is only proven once it has been restored. Restoring it on a second server, which makes that server an [[instance clone>>doc:documentation.xs.admin.backup.instance-cloning.WebHome]], both tests the backup and gives you somewhere to try the next upgrade out. |