nuvo / cain

Backup and restore tool for Cassandra on Kubernetes
Apache License 2.0
32 stars 21 forks source link

cannot restore? error in Stream: pods "cassandra" not found #14

Open c4po opened 5 years ago

c4po commented 5 years ago

I can do backup but restore doesn't work

cain backup -n dev-cassandra -c dev-cassandra -l release=dev-cassandra -k hero --dst s3:/xxxx/cassandra
2019/03/05 19:13:21 Backup started!
2019/03/05 19:13:21 Getting clients
2019/03/05 19:13:22 Getting pods
2019/03/05 19:13:22 Testing existence of data dir
2019/03/05 19:13:22 Backing up schema
2019/03/05 19:13:24 Taking snapshots
2019/03/05 19:13:24 dev-cassandra-1 Taking snapshot of keyspace hero
...
...
cain restore --src s3://xxxxx/cassandra/dev-cassandra/cassandra/ -n dev-cassandra -k hero -l release=dev-cassandra --schema 48766c -t 20190305
2019/03/05 19:48:11 Restore started!
2019/03/05 19:48:11 Getting clients
2019/03/05 19:48:11 Getting pods
2019/03/05 19:48:11 Getting current schema
2019/03/05 19:48:12 Found schema: 48766c
2019/03/05 19:48:12 Calculating paths. This may take a while...
2019/03/05 19:48:15 error in Stream: pods "cassandra" not found
c4po commented 5 years ago

I figured out the issue. I have a trailing slash in the src s3 path.. wrong: cain restore --src s3://xxxxx/cassandra/dev-cassandra/cassandra/ ... should be: cain restore --src s3://xxxxx/cassandra/dev-cassandra/cassandra ...

c4po commented 5 years ago

can we add a check here https://github.com/nuvo/cain/blob/master/pkg/cain/cain.go#L95 to remove the trailing slash. or add a check here https://github.com/nuvo/cain/blob/master/pkg/utils/path.go#L109