litestream icon indicating copy to clipboard operation
litestream copied to clipboard

Unable to recover database from a local replica

Open gustingonzalez opened this issue 3 years ago • 3 comments

Hi, there! I'm trying to recover a database by using the command litestream restore -o /tmp/db /path/to/replica.db. However, I'm getting the error database not found in config: /path/to/replica.db. Also, I tried it without specifying the -o parameter, with same error. I can only recover the database without specifying the replica parameter.

Am I making a mistake specifying the command?

Thanks in advance!

gustingonzalez avatar Nov 18 '22 20:11 gustingonzalez

@gustingonzalez What does your config file look like?

benbjohnson avatar Nov 21 '22 20:11 benbjohnson

@benbjohnson, my config file looks like the following:

# AWS credentials
# access-key-id:     AKIAxxxxxxxxxxxxxxxx
# secret-access-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxx

dbs:
  - path: /tmp/source.db            # Database to replicate from
    replicas:
      - path: /tmp/replica.db          # File-based replication

So, the command that I'm using is: litestream restore -o /tmp/restored.db /tmp/replica.db.

Note that, despite this, my understanding (according to the documentation) is that a config file wouldn't be required by using this command.

gustingonzalez avatar Nov 23 '22 11:11 gustingonzalez

@gustingonzalez If you're using a regular path then it'll try to match the database name. In that case, you'd need to specify:

$ litestream restore -o /tmp/restored.db /tmp/source.db

I believe you need to specify the replica in a URL format for it to skip the config:

$ litestream restore -o /tmp/restored.db file:///tmp/replica.db

benbjohnson avatar Nov 23 '22 21:11 benbjohnson