RicHincapie
RicHincapie

Reputation: 3983

error: unexpected EOF when kubectl cp dump.rdb file to local

I have this redis instance in a pod running on 1.21 cluster.

Running kubectl cp -c redis --request-timeout=1m redis-pod:data/dump.rdb /tmp/data/dump.rdb

or

kubectl exec --request-timeout=1m -i redis-pod -- cat /data/dump.rdb > /tmp/data/dump.rdb

I get the following two errors:

The kubectl cp approach generates: error: unexpected EOF

The second approach creates the file but incomplete, with a smaller size and when loading it with another redis instance I got a server message like the DB is corrupted and wont start.

I've ran redis SAVE command before. Also copied the dump.rdb to another directory a tried to copy that one.

Any help would be appreciated.

Upvotes: 2

Views: 1962

Answers (1)

Harsh Manvar
Harsh Manvar

Reputation: 30110

You can use the kubectl cp --retries=10 if the connection is getting timeout while copying the file.

If you are in Redis POD and just want to take out the data you can install the aws, gcp CLI and upload the whole file from POD to the bucket.

Touching Redis data files is fine, i to have played lot but would recommend checking out the Riot-Redis

Used it a lot in migrating large production system Redis data from one to another cluster.

Read more about Riot-Redis doc : https://developer.redis.com/riot/riot-redis/

RIOT-Redis is a data migration tool for Redis.

Most Redis migration tools available today are offline in nature. Migrating data from AWS ElastiCache to Redis Enterprise Cloud for example means backing up your Elasticache data to an AWS S3 bucket and importing it into Redis Enterprise Cloud using its UI. RIOT-Redis allows for live data migration between any Redis databases.

Upvotes: 3

Related Questions