Skip to content

Creating snapshots and rolling back

Though backups are the most reliable and durable way to preserve Docker images and configurations, creating a backup of an entire application is not always practical. However, you need to safeguard against potential risk when changing the system. In these cases, you can create a snapshot of the system.

Snapshot functionality provides a time-efficient and space-efficient method of copying data. Create a snapshot whenever you need a save point for Docker images, such as before committing container changes.

With both snapshot and backup, Control Center

  • Creates a tag for the Docker image of each service with metadata about the application data.
  • Creates a separate snapshot of the LVM thin pool, which stores both application data and snapshots of the application data.

Snapshots are intended to serve as short-term save points only, and therefore have a default time-to-live (TTL) value of 12 hours. If you need to keep a snapshot beyond the TTL, tag the snapshot to prevent it from being deleted after the TTL expires. For historical backups of data that you need to save long-term, create full backups instead of snapshots.

You can use the rollback functionality to go back to a snapshot image. For example, roll back if changes to an application cause a failure or other degradation. Rolling back returns the application and distributed file system to the state that existed at the time of the snapshot.

Note: Rolling back from a snapshot does not remove services that you added after creating the snapshot. That is, if you create a snapshot, add a service, and then roll back, the service remains on the system; it is not deleted as part of the roll back.

Control Center uses thin provisioning, which enables it to create snapshots of the application data volume. Thin provisioning is a virtualization method that allocates data blocks only when data is written (copy-on-write).

Because snapshots track changes to the file system over time, their space requirements expand incrementally as application data changes. Application data and snapshots share the same base device; therefore, ensure that snapshots do not fill up the base device storage. For information about extending storage, see Control Center application data storage requirements.

Creating a snapshot

  1. Log in to the Control Center host as a user with serviced CLI privileges.
  2. Find the identifier of the service; for example, Zenoss.resmgr.

    serviced service list
    
  3. Create the snapshot.

    Replace SERVICEID with the identifier of the service.

    serviced snapshot add SERVICEID
    
  4. Verify the existence of the snapshot.

    serviced snapshot list
    
  5. To keep the snapshot for longer than the default 12-hour TTL, tag it.

    Replace SNAPSHOTID with the identifier of your snapshot and TAG-NAME with your text.

    serviced snapshot tag SNAPSHOTID TAG-NAME
    
  6. To make a snapshot subject to the TTL value, untag it.

    Replace SNAPSHOTID with the identifier of your snapshot and TAG-NAME with your text.

    serviced snapshot untag SNAPSHOTID TAG-NAME
    

Rolling back to a snapshot

Before rolling back, you must stop services that are used in the snapshot image. The following procedure includes this step.

  1. Log in to the Control Center host as a user with serviced CLI privileges.
  2. To roll back to a snapshot, you must find the identifier of the snapshot.

    serviced snapshot list
    
  3. Roll back to the snapshot.

    Replace SNAPSHOTID with the identifier of your snapshot. The --force-restart flag automatically stops the affected services before rollback and starts them after completion.

    serviced snapshot rollback SNAPSHOTID --force-restart