repcached を debian etch にインストール

repcached を debian etch にインストールしてみた。

repcachedとは、memcachedにデータのレプリケーション機能を追加実装したものです。

http://lab.klab.org/wiki/Repcached#.E3.82.A4.E3.83.B3.E3.82.B9.E3.83.88.E3.83.BC.E3.83.AB

ということで、インスタンス間はマルチマスタとなり、どちらにデータを挿入しても、両方のインスタンスからデータを取ることが出来る。なかなか使い勝手のよさそうなものだ。

# ./configure --enable-replication
...
checking for libevent directory... configure: error: libevent is required.  You can get it from http://www.monkey.org/~provos/libevent/

      If it's already installed, specify its path using --with-libevent=/dir/

一発で上手くいくことってほとんど無いな・・・。
--with-libevent を追加しても以下のように動きは一緒。

# ldconfig -p |grep libevent
        libevent-1.1a.so.1 (libc6) => /usr/lib/libevent-1.1a.so.1

# ./configure --enable-replication --with-libevent=/usr/lib/
...
checking for libevent directory... configure: error: libevent is required.  You can get it from http://www.monkey.org/~provos/libevent/

      If it's already installed, specify its path using --with-libevent=/dir/

libevent-dev をインストール。

# aptitude install libevent-dev
# ./configure --enable-replication

おけおけ。

# make
# make install

無事入った。とりあえず普通の memcached として起動して接続してみる。(mysql ユーザで動かしているのに深い意味は無い)

$ memcached -v -p 11213 -u mysql &
replication: listen
$ telnet localhost 11213
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
set foo 0 0 3     
bar
STORED
get foo
VALUE foo 0 3
bar
END
quit
Connection closed by foreign host.

問題ないようだ。