LoginSignup
11
10

More than 5 years have passed since last update.

Redisのデータをダンプしてリストア(インポート)するツールrdd

Posted at

複数のredisのデータを統合したい等、rdbファイルでのバックアップだけでは困る場合に。

インストール

# hiredisが必要
yum install gcc
git clone https://github.com/redis/hiredis.git
cd hiredis/

make
make install

# hiredisのdirにrdd.cをダウンロードするのが一番簡単
wget https://raw.githubusercontent.com/r043v/rdd/master/rdd.c --no-check-certificate

gcc -std=c99 rdd.c libhiredis.a -o /usr/local/bin/rdd

使い方

基本はreadme
https://github.com/r043v/rdd

# 特定のkeyをsave1.rddにdumpする
rdd "keyname*" -o save1.rdd -s localhost -p 6379 -a masterpass

# ダンプファイルからデータをimportする
rdd save1.rdd -o insert -s localhost -p 6379

# ダンプファイルから特定のキーを除外する
rdd save1.rdd -f "*20140331*" -o save2.rdd

使ってみたところdumpfileが2G以上のものをimportしようとするとsegvで落ちるようです。
カジュアルに使ってみる分には便利かも。

11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
10