Created
October 11, 2021 22:29
-
-
Save jordanlewis/4e4fa1ff34e09ebbcfd658268ece773d to your computer and use it in GitHub Desktop.
Example userfile workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create database | |
create database mydb; | |
use mydb; | |
create table foo (i int primary key); | |
insert into foo select * from generate_series(1, 100); | |
create database backups; | |
-- Backup: | |
use backups; | |
backup database mydb to 'userfile://backups.userfiles/backup1' as of system time '-10s'; | |
-- Get the backup: | |
cockroach userfile get --url $PGURL 'userfile://backups.userfiles/backup1' ~/backup1 | |
-- Run a local cockroach node: | |
cockroach start-single-node --external-io-dir=~/backup1 --advertise-addr localhost --insecure & | |
-- Restore into the local cockroach node | |
restore database mydb from 'nodelocal://0/backup1'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment