Pause or Terminate Sync
On this page
Overview
If you want to disable Realm Sync for your app, you can temporarily pause or permanently terminate it. You can also re-enable Sync after disabling it.
You can temporarily pause Sync if you need to pause your cluster. With a temporary pause, you can resume without resetting your Sync configuration or losing Sync metadata.
You can permanently terminate and re-enable Sync for troubleshooting or if you want to change your Sync configuration.
Pause Sync
You can pause Realm Sync for a period of time without disabling it entirely. When you pause Sync, you stop syncing changes between Atlas and your application.
Pausing Sync rejects any incoming client connections. This means that pausing Realm Sync for your Realm app stops syncing changes for all clients.
To pause Sync from the client side, using logic that situationally pauses Sync during a session, see your preferred SDK:
After pausing Sync, you can re-enable it. Pausing Sync maintains the configuration settings and all of the Sync metadata, which contains the sync history. When you re-enable paused Sync, your clients can reconnect normally.
If your oplog rolls past the time that you paused Sync, you must terminate and re-enable Sync. For example, if you only keep 12 hours of oplog for your cluster, and you pause Sync for longer than 12 hours, you must terminate and re-enable Sync.
Terminating and re-enabling paused Realm Sync for your Realm app erases Realm Sync metadata and requires you to specify configuration settings again. Clients must perform a client reset when they reconnect after Realm Sync has been terminated. For more information, see: Terminate Sync.
Procedure
Resume Sync
After you have paused Realm Sync, you can resume it to begin syncing again for all clients.
If your oplog rolls past the time that you paused Sync, you must terminate and re-enable Sync. For example, if you only keep 12 hours of oplog for your cluster, and you pause Sync for longer than 12 hours, you must terminate and re-enable Sync.
Terminating and re-enabling paused Realm Sync for your Realm app erases Realm Sync metadata and requires you to specify configuration settings again. Clients must perform a client reset when they reconnect after Realm Sync has been terminated. For more information, see: Terminate Sync.
Procedure
The process to resume Sync is the same as the process to re-enable Sync. However, when you pause Sync, MongoDB Realm preserves your configuration settings and Sync metadata.
To re-enable Realm Sync, follow the steps in the Enable Realm Sync guide. You can skip the Configure Sync step.
Clients do not need to perform a client reset when reconnecting after a pause.
Terminate Sync
If you have enabled Realm Sync, you may have to terminate and re-enable Realm Sync under a few different circumstances:
- Altering a Partition-Based Sync configuration
- Switching between Sync modes. For instance, if you are switching from Partition-Based Sync to Flexible Sync
- An upgrade from a Shared Tier Atlas Cluster to a Shared or Dedicated instance
- A move to an Atlas cluster that is distributed across regions/cloud providers
- An upgrade to NVMe Atlas clusters
- An oplog rollover
- A paused Realm Sync session on a shared tier cluster due to infrequent usage
- Troubleshooting, at the request of MongoDB Support
When you terminate and re-enable Realm Sync, clients can no longer Sync. Your client must implement a client reset handler to restore Sync. This handler can discard or attempt to recover unsynchronized changes.
Procedure
Terminate Realm Sync in your Realm app to stop syncing data across devices.
Re-Enable Sync
After you have terminated Realm Sync, you can re-enable it. Re-enabling Sync enables your Realm app to begin syncing changes to Atlas again. After you re-enable Sync, your Realm app begins accepting incoming client connections again. However, if a client had previously connected to your Realm app before you terminated Realm Sync, you must perform a manual client reset for that client to enable it to connect to MongoDB Realm again.
Procedure
When you pause Sync, MongoDB Realm preserves your configuration settings, and you can skip the Configure Sync step. When you terminate Sync, or when the oplog rolls past the time that you paused Sync, you must specify the configuration settings again.
To re-enable Realm Sync, follow the steps in the Enable Realm Sync guide.
If you are re-enabling Realm Sync after you have terminated it, you must perform a manual client reset in your client applications: