Data image
Published 30 November 2021
Contents
What is a data image?
A data image is a complete, point-in-time copy of the database files of a database instance, which can be empty or created from a backup file.
This means the entire instance with ALL its databases and not just a single or a subset of its databases.
It's a fundamental component that contains the necessary information to generate/spawn databases in Redgate Clone. It is analogous to an extension to a Docker image and it's the static template or blueprint from which data containers are created but, unlike a data container, it's not a running instance of a database.
Because of its nature, you can't connect to a data-image
as it's a read-only representation of database files. Instead, you will create data containers from data images and those will be live databases you can connect to.
A data image definition, specified in a yaml
file, is composed of at least a name (name
field), a source type (sourceType
field), an engine (engine
field), and an engine version (version
field).
Data image definition example
Please check the Data Image Definition Examples how-to guide for more in-depth examples covering all the possible source types.
Data image definition fields
This section provides an overview of the fields that you can set in an image definition yaml
file.
Name
Data image names can contain letters, digits, and -
, _
and . special characters. The names are case sensitive, and have to include non-numeric characters (i.e., a name cannot be a number). A name cannot be longer than 63 characters.
Lifetime
This is the duration of an image.
The value is a number followed by a unit. Ex: "5m" for five minutes.
Valid units are "h", "m", "s".
If you specify a lifetime for a data image, it will be automatically deleted after the time specified.
If no value is provided, your data image will use the instance default data image lifetime.
The value "0", means it won't be deleted, so it lives indefinitely.
If there are data containers running for the expired data image, the data image will not be removed.
Source
The mandatory data image source (sourceType
field) describes the place from which data in the data image comes from and its type.
You can choose from one of these supported sources:
- empty - A data image with no content on it other than a vanilla installation of the database engine with system tables.
- backup - A data image whose content will be what you defined in your backup file(s).
- NOTE: See Data image definition: Backups for more information.
The source of data and schema is defined in the yaml
configuration file that represents the data image. Depending on which source you want to use, you will need to define a different type of configuration file.
Engine and Version
Please check Database Engine Support for more details on what features are currently implemented for each database engine and version.
Tag
You can add one or more data image tag(s) (tags
field) to the image definition file. Tags are optional fields.
Storage
Data images are automatically stored in dedicated disks (block device volumes) attached to the cloning nodes in the cluster. Please see Data storage for more information.
Pre and post-scripts
You can provide a pre-script that runs before any other operations, as well as a post-script one to be run after the database restore. See the Data Image Definition Examples page for an example. Pre and post scripts only work when the source is "backup".