docs/main/deployment-guide/backup-disaster-recovery.mdx
Options to protect your Mattermost server from different types of failures range from simple backups to sophisticated disaster recovery deployments and automation.
The state of your Mattermost server is contained in multiple data stores that need to be backed up and restored separately to fully recover your system from failure.
To back up your Mattermost server:
config/config.json. If you are using SAML configuration for Mattermost, your SAML certificate files will be saved in the config directory. Therefore, we recommend backing up the entire directory.<Note>
- If you use local storage using the default
./datadirectory, back up this directory.- If you use local storage using a non-default directory specified in the
Directorysetting inconfig.json, back up files in that location.- If you store your files in S3, you can typically keep the files where they are located without backup.
To make a clean backup, you must stop Mattermost during the duration of the backup, otherwise the database and files may become out of sync.
</Note>To restore a Mattermost instance from backup, restore your database, config.json file, and optionally the locally stored user files into the locations from which they were backed up.
An appropriate disaster recovery plan weighs the benefits of mitigating specific risks against the cost and complexity of setting up disaster recovery infrastructure and automation.
<Note>High availability (HA) vs. disaster recovery (DR)
HA and DR are distinct concepts that are often confused. HA refers to a clustered deployment within a single site that eliminates single points of failure and keeps Mattermost running through individual component outages (e.g., a failed app node or database replica). DR addresses the broader scenario of an entire site or region becoming unavailable, and typically requires a secondary deployment in a separate data center or cloud region.
Mattermost supports active/passive DR, where a secondary site is kept in sync but only activated during a failover. Mattermost does not support active/active deployments, where both sites serve live traffic simultaneously.
</Note>Automating backups for a Mattermost server provides a copy of the server's state at a particular point in time, which can be restored if a failure in the future leads to loss of data. Options include:
Recovering from a failure using a backup is typically a manual process and will incur downtime. The alternative is to automate recovery using a high availability deployment.
For step-by-step instructions on setting up Mattermost in an active/passive DR configuration across two data centers, including how to replicate the database, file storage, and search indices, and how to perform a failover, see the platform-specific guide:
When using Single Sign-on with Mattermost Enterprise Edition, an outage to your SSO provider can cause a partial outage on your Mattermost instance.
What happens during an SSO outage?
In each case, the user cannot reach the SSO provider, and cannot log in. In either case, several mitigations are available:
If you're using a self-hosted Single Sign-on provider, several options are available for High Availability configurations that protect your system from unplanned outages.
For SaaS-based authentication providers, while you still have a dependency on service uptime, you can set up redundancy in source systems from which data is being pulled. For example, with the OneLogin SaaS-based authentication service, you can set up High Availability LDAP connectivity to further reduce the chances of an outage.
Create a custom Identity Provider for SAML authentication that connects to both an active and a standby authentication option, that can be manually or automatically switched in case of an outage.
In this configuration, security should be carefully reviewed to prevent the standby SSO option from weakening your authentication protocols.
When users are unable to reach your organization's SSO provider during an outage, an error message directing them to contact your support link (defined in your System Console settings) is displayed.
Once IT is contacted about an SSO outage, they can temporarily change a user's account from SSO to email-password using the System Console, and the end user can use their email and password to claim the account until the SSO outage is over and the account can be converted back to SSO.
When the outage is over, it's critical to switch everyone back to SSO from email-password to maintain consistency and security.