记一次redis数据修复

运维同学一不小心将redis数据清空了。

redis中大部分数据都不重要,只有一个排行榜数据,需要按排行榜名次发放奖励。

记下这次修复的方案:

grep 限时 moon30001-gold_2015-08-21.log | awk -F ' ' '{print $3}' | awk -F '(' '{print $1}' | sort | uniq -c | sort -n | awk -F ' ' '{print $1*20,$2}'

从log中取出所有分数及角色id.

redis-cli -p 7000 EVAL "local a=redis.call('zscore','shenJiang.score.20150821','506027'); if not a  then return redis.call('zadd','shenJiang.score.20150821','201440149466188','506027') end;return a" 0

使用lua脚本恢复排行榜数据。

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /opt/wordpress/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048