myENA / consul-backinator

Command line Consul backup and restore utility supporting KVs, ACLs and Queries
Mozilla Public License 2.0
226 stars 22 forks source link

backup works with 1.0 but fails with 1.4 #24

Closed mg03 closed 7 years ago

mg03 commented 7 years ago

HI

Cuurently using 1.0 version

consul-backinator backup file=/tmp/bkupfile prefix=/ 2017/02/16 22:09:39 [Success] Backed up 0 keys from / to consul.bak Keep your backup (consul.bak) and signature (consul.bak.sig) files in a safe place. You will need both to restore your data.

Trying to use 1.4 version

./consul-backinator-1.4 backup file=/tmp/bkupfile prefix=/ 2017/02/16 22:04:43 [Error] Failed to backup key data: No keys found

Same command fails with 1.4 , what am i doing wrong here

aaronhurt commented 7 years ago

That command is actually working the same in both versions .... later versions consider an empty list of keys to be an error. If you try the same commands against a cluster with at least one key/value pair present it should work.

aaronhurt commented 7 years ago

The code generating that error resides in backup.go on line 37 where it checks the length of the returned keys.

mg03 commented 7 years ago

@leprechau : I am running thr 1.0 and the 1.4 versions against the same cluster. The 1.0 version finds and backups the kvs but the 1.4 version does not seem to find the kvs.

aaronhurt commented 7 years ago

Your post above with the 1.0 output says it backed up 0 keys ... that's not a success since it didn't do anything. That's why an empty key list was changed to an error in later versions.

mg03 commented 7 years ago

ok, so here is the thing, if I provide a token it works.

I was under the impression that if no token is provided, it will use the local agents token. The godoc for consul api https://godoc.org/github.com/hashicorp/consul/api#Config states that the Token is used to override the agents default token Is this not the case?

aaronhurt commented 7 years ago

Are you using ACLs? If you are using ACLs you will absolutely need to pass an access token to get access to the key list. You also won't be able to use the 1.0 version of the client against 0.7.0+ or newer consul clusters because they changed how the ACL token is passed.

If you are running a version of consul older than 0.7.0 with ACLs you will need to use consul-backinator 1.3 or older.

If you are running consul 0.7.0+ or newer with ACLs you need to use 1.4 or newer of consul-backinator.

mg03 commented 7 years ago

its working ... thanx for your help .. good tool, ive been using it since 1.0-dev version 👍

aaronhurt commented 7 years ago

@mg03 great, let me know if you need anything else.