Backup and restore cockroach DB

2. Klick add key, then download the in json format. After that convert key file to be base 64 format, we can user online base64 converter.

3. Create folder backup on google cloud storage

4. Create backup scheduler on cockroach DB

CREATE SCHEDULE backup_scheduleFOR BACKUP INTO ‘gs://backup?AUTH=specified&CREDENTIALS={base 64 gcp key}’RECURRING ‘0 21 * * *’FULL BACKUP ALWAYSWITH SCHEDULE OPTIONS ignore_existing_backups;

Note : replace {base 64 gcp key} with base64 converted gcp service account key file.

Based on query above, RECURRING ‘0 21 * * *’ means the scheduler will run every 09:00 PM every day, and ignore_existing_backups means we ignore existing backup, so that the backup can be proceed.

We can check whatever schedule that we have created before with query :

SHOW SCHEDULES;

The important column is nest_run column.

5. Check backup file in google cloud storage

SHOW BACKUPS IN ‘gs://backup?AUTH=specified&CREDENTIALS={base 64 gcp key}’

6. Restore existing backup to new DB environment

restore database example FROM ‘2022/04/03–100000.42’ IN ‘gs://backup?AUTH=specified&CREDENTIALS={base 64 gcp key}’;

source : https://www.cockroachlabs.com/docs/stable/backup.html?filters=gcs

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Accessible tables for everyone

From zero to WIP

Leverage PodSpec to customize the Fission runtime and builder pods

Basic Python Data Structures: Sets

Ruby on Rails — Phase 4 Project

How To Scrape MercadoLibre With Python And Beautiful Soup?

Scrape MercadoLibre With Python And Beautiful Soup

One-on-Ones Don’t Exist in the Scrum Guide — Why Do We Do Them?

Managing Interactive BI Performance Acceldata

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
wahyu eko hadi saputro

wahyu eko hadi saputro

i am a reader

More from Medium

Prometheus Alertmanager — Custom email Alert configuration & templating

GitLab Runner Operator on Power

Adding a worker node to a Kubernetes cluster

Cloud-Scale Networking: NSX Datacenter Hierarchical Tier-0s, blending telecom with cloud