Backing up my confluence (latest version)
Asked by Elad Dotan:

Hi,

I want to make sure my server is completely backed up.

this is what I do:

1. schedule a daily backup of my site to /var/atlassian/application-data/confluence/backups (in conlfuence administrator)
2. I have the following script that will also backup data and my mysql scheme.

This is the script:

#!/bin/bash -x  
CNFL=**/var/atlassian/application-data/confluence**   
CNFL_BACKUP=/home/cnflBackup/\`date +%Y%m%d-%H%M%S\`  

rm -rf $CNFL/temp/\*  
mkdir $CNFL_BACKUP  
mysqldump --defaults-file=\~/.my.conf confluence \|gzip \> $CNFL_BACKUP/confluence.mysql.data.gz  
tar -cjvf $CNFL_BACKUP/data.bzip $CNFL \> $CNFL_BACKUP/homedir.status  
\[root@CentOS-7 elad\]# cat backup.sh   
#!/bin/bash -x  
CNFL=/var/atlassian/application-data/confluence  
CNFL_BACKUP=/home/cnflBackup/\`date +%Y%m%d-%H%M%S\`  

###rm -rf $CNFL/temp/\*  
mkdir $CNFL_BACKUP  
mysqldump --defaults-file=\~/.my.conf confluence \|gzip \> $CNFL_BACKUP/confluence.mysql.data.gz  
tar -cjvf $CNFL_BACKUP/data.bzip $CNFL \> $CNFL_BACKUP/homedir.status

* am I missing anything?
* the files and folders I backup in Confluence "backup Administration" is the same as my script?
* **/var/atlassian/application-data/confluence - is the folder I want to backup?**
* **what about backing up /opt/atlassian/confluence ? do I need to backup this one as well?**


Answers:
author: Elad Dotan
body: what about backing up /opt/atlassian/confluence ?

I also edited server.xml and web.xml - don't we need to backup these files and folders?


author: chucktalk
body: Hi Elan,

The preferred method is to us the [Production Backup Strategy](https://confluence.atlassian.com/display/DOC/Production+Backup+Strategy), which is to use the native backup tools provided by your database, as below:

Establishing a production system backup solution {#toc-hId-1676221152}
----------------------------------------------------------------------

Atlassian recommends establishing an alternative database backup strategy:

* Create a backup or dump of your database using tools provided by your database  
  :warning: To avoid any data inconsistency and corruption, it is recommended to shut down Confluence before creating a database backup or dump.
* Create a file system backup of your Confluence home directory
* Create a file system backup of your shared home directory (Clustered instances only)

Once this is in place, disable the daily backups through the [scheduled jobs](https://confluence.atlassian.com/display/DOC/Scheduled+Jobs) feature via **'Administration Console \> Administration \> Scheduled Jobs'**.

We want to stress that creating these two backups is *better* than having a Confluence XML backup. It is more robust and far more reliable for large production instances. You will be able to restore your whole site, including all data, attachments and configuration information intact with these two backups. See [Restoring Data from other Backups](https://confluence.atlassian.com/display/DOC/Restoring+Data+from+other+Backups).

Which files need to be backed up? {#toc-hId--875935809}
-------------------------------------------------------

Backing up the whole home directory is the safest option, however most files and directories are populated on startup and can be ignored. At minimum, these files/directories *must* be backed up:

* **\<conf-home\>/confluence.** **cfg.xml**
* **\<conf-home\>/attachments**

The rest of the directories will be auto-populated on start up. You may also like to backup these directories:

* **\<conf-home\>/config**-- if you have modified your ehcache.xml file.
* **\<conf-home\>/index** -- if your site is large or reindexing takes a long time -- this will avoid the need for a full reindex when restoring.

The location of the home directory is configured on installation and is specified in the `confluence.init.properties` file. For installation created with the automatic installer the default locations are:

* Windows `C:\Program Files\Atlassian\Application Data\Confluence`
* Linux `/var/atlassian/application-data/confluence`

**For Clustered instances only:** Backing up the whole shared home directory is the safest option, however some files and directories are populated at runtime and can be ignored:

* \<conf-home\>/thumbnails
* \<conf-home\>/viewfile.

I do hope this information is helpful to you.

Sincerely,

Chuck Talk \| Confluence Support  
Atlassian


author: Timothy
body: Everything looks good. There are some configurations in /opt/atlassian/confluence/confluence/WEB-INF/classes that you may want to consider backing up if they have been modified.