Couchbaseのバックアップとリストア

Couchbaseをダンプしてバックアップしようと思い試してみました。
その時のメモです。


このバックアップはBucket TypeがCouchbaseのものしか出来ません。


環境

OS CentOS 6.4
Couchbaseバージョン couchbase-server-2.0.1-170



Couchbaseサーバー名 IPアドレス
couchbase01.example.com 10.0.0.1
couchbase02.example.com 10.0.0.2
couchbase03.example.com 10.0.0.3
couchbase04.example.com 10.0.0.4


ダンプ

バックアップ対象バケット名 test
バックアップデータ保存ディレクトリ /tmp/couchbasebackup


ダンプコマンド

以下のコマンドを実行することでダンプファイルが指定ディレクトリ以下に作成されました。

/opt/couchbase/bin/cbbackup http://couchbase01.example.com:8091 /tmp/couchbasebackup -u Administrator -p Administrator -b test


ダンプ後以下のようなファイルが作成されました。
Couchbaseクラスタサーバーは4台あるので4台分。

/tmp/bucket-test/node-10.0.0.1%3A8091/data-0000.cbb
/tmp/bucket-test/node-10.0.0.2%3A8091/data-0000.cbb
/tmp/bucket-test/node-10.0.0.3%3A8091/data-0000.cbb
/tmp/bucket-test/node-10.0.0.4%3A8091/data-0000.cbb


リストア

リストア対象バケット名 test
リストアデータ保存ディレクトリ /tmp/couchbasebackup


リストアコマンド

以下のコマンドを実行することで先程ダンプしたデータを同じ名前のバケットにリストアすることが出来ました。

/opt/couchbase/bin/cbrestore /tmp/couchbasebackup http://Administrator:Administrator@couchbase01.example.com:8091 --bucket-source=test --bucket-destination=test


ちなみにこれらのダンプ&リストアテストは

同じCouchbaseクラスタで、

  1. バケット作成
  2. キーと値をsetする
  3. ダンプ
  4. バケット削除
  5. 同じ名前でバケットを再作成
  6. リストア
  7. 先程setしたキーで値をget出来るか確認

の手順で行いました。