Restore databases in a Kubernetes environment
This guide explains how to restore databases that ScalarDB or ScalarDL uses in a Kubernetes environment. Please note that this guide assumes that you are using a managed database from a cloud services provider as the backend database for ScalarDB or ScalarDL.
Procedure to restore databases
-
Scale in ScalarDB or ScalarDL pods to 0 to stop requests to the backend databases. You can scale in the pods to 0 by using the
--set *.replicaCount=0
flag in the helm command.- ScalarDB Server
helm upgrade <release name> scalar-labs/scalardb -n <namespace> -f /path/to/<your custom values file for ScalarDB Server> --set scalardb.replicaCount=0
- ScalarDL Ledger
helm upgrade <release name> scalar-labs/scalardl -n <namespace> -f /path/to/<your custom values file for ScalarDL Ledger> --set ledger.replicaCount=0
- ScalarDL Auditor
helm upgrade <release name> scalar-labs/scalardl-audit -n <namespace> -f /path/to/<your custom values file for ScalarDL Auditor> --set auditor.replicaCount=0
- ScalarDB Server
-
Restore the databases by using the point-in-time recovery (PITR) feature.
For details on how to restore the databases based on your managed database, please refer to the Supplemental procedures to restore databases based on managed database section in this guide.
If you are using NoSQL or multiple databases, you should specify the middle point of the pause duration period that you created when following the backup procedure in Back up a NoSQL database in a Kubernetes environment.
-
Update database.properties, ledger.properties, or auditor.properties based on the newly restored database.
Because the PITR feature restores databases as another instance, you must update the endpoint information in the custom values file of ScalarDB or ScalarDL to access the newly restored databases. For details on how to configure the custom values file, see Configure a custom values file for Scalar Helm Charts.
Please note that, if you are using Amazon DynamoDB, your data will be restored with another table name instead of another instance. In other words, the endpoint will not change after restoring the data. Instead, you will need to restore the data by renaming the tables in Amazon DynamoDB. For details on how to restore data with the same table name, please see the Amazon DynamoDB section in this guide.
-
Scale out the ScalarDB or ScalarDL pods to 1 or more to start accepting requests from clients by using the
--set *.replicaCount=N
flag in the helm command.- ScalarDB Server
helm upgrade <release name> scalar-labs/scalardb -n <namespace> -f /path/to/<your custom values file for ScalarDB Server> --set scalardb.replicaCount=3
- ScalarDL Ledger
helm upgrade <release name> scalar-labs/scalardl -n <namespace> -f /path/to/<your custom values file for ScalarDL Ledger> --set ledger.replicaCount=3
- ScalarDB Server