By default, Confluence runs its daily backup at 2.00 AM. You can configure Confluence to perform the backup at a time that is best suited to you or your organisational needs.

Confluence uses Quartz for scheduling periodic jobs. To change the time of your daily backup, you will need to edit the Quartz configuration.

To change the time of your daily backup

  1. Open the Quartz configuration file schedulingSubsystemContext.xml located under confluence/WEB-INF/classes/

  2. Find the following section of the file:

    <bean id="backupTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
      <property name="jobDetail">
        <ref bean="backupJob"/>
      </property>
      <property name="cronExpression">
        <value>0 0 2 * * ?</value>
      </property>
    </bean>
    

  3. The string '0 0 2 * * ?' sets up a Cron Trigger for the job to run at the zeroth second of the zeroth minute of the 2nd hour, every day of every month, every day of the week.

  4. You can set a new time by editing this string. Note that the date and time format in this configuration file is in this order:
    Second minute hour day

(info) For example, to set the new time to twenty past ten PM, change the string to '0 20 22 * * ?'.

If you wanted to back up only once a week, for example, at midnight on Sundays, you would change the string to '0 0 0 ? * SUN'.

For complete details on the formatting of the cron string, please see http://www.opensymphony.com/quartz/api/org/quartz/CronTrigger.html.

Clustered Environment

The recommended approach for backing up a clustered instance of Confluence is to use your database backup tools to backup the database, and backup the home directory of one node in the cluster. You can then disable the automatic Confluence backup, which is not suitable for large instances which clusters typically are.

The remainder of this section covers the unusual case where you want to change the configuration of the automatic backup in a cluster.

Scheduled tasks in a cluster are configured to run either on every node (like indexing), or on just a single node. The daily backup is configured to run on a single node, but this is easy to change if you understand how Confluence ensures these jobs only execute once.

To ensure the daily backup only starts on one node, Confluence uses a locking system. The first node to kick off the scheduled backup (even if it is only several milliseconds ahead) will acquire a lock which prevents subsequent nodes from running the backup. The lock is specific to the task and the scheduled time the task was due to start at. Later nodes checks for an existing lock with the backup task and the time they have scheduled, and skip the job if it already exists.

There are three important consequences of this:

  1. if you want one backup but don't care where it happens, you need to ensure the scheduled time on each node is the same
  2. if you want one backup on one particular node (no backup redundancy), you need to disable the backup on all the other nodes
  3. if you want a backup on each node, you need to change the scheduled times on each node. (Because of the performance impact on the database of running a full backup, scheduled backups on different nodes should not overlap.)

None of these approaches is recommended. Automatic backup is not suitable for instances with large amounts of data, and clusters are not generally small instances of Confluence. The recommended approach is to use a database backup tool to backup the database, and a filesystem backup tool to save the Confluence home directory (preferably at the same time).

The example below shows how to a backup job to be executed on Node A at 2:00 AM and on Node B at 3:00 AM. You can use this configuration to get a backup on both nodes, as long as your backup always completes within 1 hour. (Check the timestamps on the previous backup ZIP files to verify this.)

Node A schedulingSubsystemContext.xml (see above for full configuration)

...
    <value>0 0 2 * * ?</value>
...

Node B schedulingSubsystemContext.xml

...
    <value>0 0 3 * * ?</value>
...

The default configuration in a cluster is the same as a normal instance of Confluence: the backup job is enabled for 2 AM on all nodes. As discussed above, the first node to acquire a lock on this job will execute it, so the backup will be done potentially by a different node every time.

関連トピック