Links
Comment on page

Data Backup and Restore

Grainite is a distributed database that internally replicates data across nodes. It is recommended to place the nodes in separate fault domains, therefore backups for the purpose of data redundancy are not necessary. However, most enterprises implement backups as an operational best practice. Grainite supports entire cluster data backup and restore capabilities only.

Data Backup:

$> gx cluster backup --help
Usage:
Backup cluster state to cloud storage or get the state of an ongoing backup.
Examples:
S3: gx cluster backup --backup-location s3://bucket/location?AWS_ACCESS_KEY_ID=ABCDEF&AWS_SECRET_ACCESS_KEY=123456 --passphrase=abc123
GCP: gx cluster backup --backup-location gs://bucket/location --gcp-sa-file ~/sa_auth.json --passphrase=abc123
Azure: gx cluster backup --backup-location \
az://container/location?DefaultEndpointsProtocol=https;AccountName=ABCDEF;AccountKey=123456;EndpointSuffix=core.windows.net --passphrase=abc123
gx cluster backup [-hqvV] [--omit-logs] [--skip-health-check] [--tls] [-c[=<YAML config>]] [--backup-id=<backupId>] --destination=<backupLocation> [-e=<envName>] [--gcp-sa-file=<saAuthFile>] [--gxFile=Use the given
properties file instead of the one at {user.home}/.gx.] [-H=<host>] [--health_port=<healthPort>] [--log_port=<logPort>] [-p=<port>] [-P=<adminPort>] [--pass=<clientCertificatePassword>]
--passphrase=<passPhrase> [-r=<refreshTime>]
Options:
--backup-id=<backupId> Backup ID for a previous backup. This can be used to get the status of an existing backup request.
-c, --config[=<YAML config>]
Path to YAML config file.
If an existing YAML config file exists in the current directory,that YAML file is used automatically.
--destination, --backup-location=<backupLocation>
Destination URI of the backup in AWS S3, Google Cloud Storage, or Azure Blob Storage.
-e, --env_name=<envName> Environment name.
There are multiple ways to set the env name.Here they are, in order of precedence from highest to lowest:
1. --env_name flag
2. app configuration (YAML)
3. environment variable ($GRAINITE_ENV)
4. gx config file
Default: default
--gcp-sa-file, --gcp-sa-auth=<saAuthFile>
Path to the gcp service account json.
--gxFile=Use the given properties file instead of the one at {user.home}/.gx.
-h, --help Show this help message and exit.
-H, --host=<host> Server IP address. Default: localhost
--health_port=<healthPort>
Server health check endpoint port. Default 5064
--log_port=<logPort> Port to get logs from local docker instance. Default 5065
--omit-logs Explicitly disallow backing up logs.
-p, --port=<port> Data service port. Default: 5056
-P, --admin_port=<adminPort>
Admin port, Default: 5057
--pass=<clientCertificatePassword>
Client pkcs12 certificate password. To be used with --tls.
--passphrase=<passPhrase>
Passphrase to encrypt data in backup.
-q, --quiet Quiet output. Only show warnings and errors.
-r, --refresh-time=<refreshTime>
Time in seconds to refresh backup status. Default: 5 s
--skip-health-check Skip health check to attempt to server regardless of server state.
--tls Use TLS. Client certificates must be set in the gx properties file to use this TLS.
-v, --verbose Print out stack traces for errors.
-V, --version Print version information and exit.
Before running the command below, ensure that the Kubernetes context is set correctly.

Data Restore:

gx cluster restore
$> gx cluster restore --help
Usage:
Restore cluster state from a backup in a cloud storage bucket.
Examples:
S3: gx cluster restore --backup-location s3://bucket/location?AWS_ACCESS_KEY_ID=ABCDEF&AWS_SECRET_ACCESS_KEY=123456 --passphrase=abc123
GCP: gx cluster restore --backup-location gs://bucket/location --gcp-sa-file ~/sa_auth.json --passphrase=abc123
Azure: gx cluster backup --backup-location \
az://container/location?DefaultEndpointsProtocol=https;AccountName=ABCDEF;AccountKey=123456;EndpointSuffix=core.windows.net --passphrase=abc123
gx cluster restore [-hqvV] [--skip-health-check] [--tls] [-c[=<YAML config>]] [-e=<envName>] [--gcp-sa-file=<saAuthFile>] [--gxFile=Use the given properties file instead of the one at {user.home}/.gx.] [-H=<host>]
[--health_port=<healthPort>] [--log_port=<logPort>] [-p=<port>] [-P=<adminPort>] [--pass=<clientCertificatePassword>] --passphrase=<passPhrase> --source=<backupLocation>
Options:
-c, --config[=<YAML config>]
Path to YAML config file.
If an existing YAML config file exists in the current directory,that YAML file is used automatically.
-e, --env_name=<envName> Environment name.
There are multiple ways to set the env name.Here they are, in order of precedence from highest to lowest:
1. --env_name flag
2. app configuration (YAML)
3. environment variable ($GRAINITE_ENV)
4. gx config file
Default: default
--gcp-sa-file, --gcp-sa-auth=<saAuthFile>
Path to the gcp service account json.
--gxFile=Use the given properties file instead of the one at {user.home}/.gx.
-h, --help Show this help message and exit.
-H, --host=<host> Server IP address. Default: localhost
--health_port=<healthPort>
Server health check endpoint port. Default 5064
--log_port=<logPort> Port to get logs from local docker instance. Default 5065
-p, --port=<port> Data service port. Default: 5056
-P, --admin_port=<adminPort>
Admin port, Default: 5057
--pass=<clientCertificatePassword>
Client pkcs12 certificate password. To be used with --tls.
--passphrase=<passPhrase>
Passphrase to encrypt data in backup.
-q, --quiet Quiet output. Only show warnings and errors.
--skip-health-check Skip health check to attempt to server regardless of server state.
--source, --backup-location=<backupLocation>
Source URI of the backup in AWS S3, Google Cloud Storage, or Azure Blob Storage.
--tls Use TLS. Client certificates must be set in the gx properties file to use this TLS.
-v, --verbose Print out stack traces for errors.
-V, --version Print version information and exit.