Questo contenuto non è disponibile nella lingua selezionata.
Chapter 10. Backing Up and Restoring Cartridges
snapshot and restore features for user applications. These features enable OpenShift Enterprise application developers to:
- Snapshot the current state of an application to create a backup.
- Restore an application from an archived state.
- Copy or rename an application by taking a snapshot, creating a new application, then restoring the snapshot data to the new application.
10.1. Snapshot Copia collegamentoCollegamento copiato negli appunti!
rhc snapshot save command, OpenShift Enterprise creates an archive of the application and performs the following steps:
- Stops the application by running the
gear stopcommand. - Runs the
control pre-snapshotcommand for each cartridge on the gear. You can control cartridge serialization in the snapshot by implementing thecontrol pre-snapshotcommand in conjunction with exclusions. For example, you can snapshot to a database dump instead of a database file. - Builds a list of exclusions from the
snapshot_exclusionsentry in the$cartridge_name/metadata/managed_files.ymlfile for each cartridge on the gear. - Creates an archive of the application in
tar.gzformat and writes it tostdoutfor use by the client tools. In addition to the files listed in thesnapshot_exclusionsentry in themanaged_files.ymlfile, OpenShift Enterprise excludes the following files:- Selected gear user files:
.tmp,.ssh,.sandbox. - Application state file:
app-root/runtime/.state. - Bash history file:
$OPENSHIFT_DATA_DIR/.bash_history.
- Runs the
control post-snapshotcommand for each cartridge on the gear. Use this script to cleanup after the snapshot runs. - Will either stop or start the gear based on the state of the application before the snapshot.
Use the optional snapshot_exclusions entry in the $cartridge_name/metadata/managed_files.yml file to list files to exclude from the snapshot and restore process. File patterns originate from the OPENSHIFT_HOMEDIR directory, not the cartridge directory. Do not exclude files that your cartridge requires to operate.
Example 10.1. snapshot_exclusions Entry
snapshot_exclusions: - mydir/*
snapshot_exclusions:
- mydir/*
tar command when performing snapshots. See the tar man page --exclude-from option for more information.