I made a horrible mistake when using Redis
1 min readMar 28, 2018
Earlier this morning I was trying to fix some data in my Redis database, I renamed one key to another with the RENAME command, without realizing the key I renamed to already existed. So what happened? Here is the doc:
If
newkey
already exists it is overwritten, when this happens RENAME executes an implicit DEL operation,
When you execute RENAME key1 key2
, the data in key2 will be deleted, and unless you have dumped the data, there is no way to get your data back. That’s how I lost my data. Right now I am crawling the etherscan.io page to get them back, it might take me an entire afternoon.
The merit of my story, backup you key before you use RENAME
.