38. 構築手順 : Telnet接続確認
$ telnet example..aa.001.apne1.cache.amazon.aws.com 11211
Trying 10.xx.xx.xx...
Connected to example.aa.001.apne1.cache.amazon.aws.com.
Escape character is '^]'.
stats telnetでendpointの1つに接続
STAT pid 1
STAT version 1.4.5
---snip--- 【stats】コマンド
STAT reclaimed 0 ノードの状態確認
END
set key1 0 0 4 【set】コマンド
test データの格納
STORED 例) key: key1, value:test
get key1
【get】コマンド
VALUE key1 0 4
格納されたデータの取得
test
例) key: key1
END
quit 【quit】コマンド
Connection closed by foreign host. 切断
41. 利用手順:EC2側の環境構築
必要なライブラリのインストール(Amazon Linuxの例)
$ sudo yum –y install subversion php-devl php-pear gcc make libmemcached
libmemcached-devel php-pecl-memcached
Ketamaの取得からインストールまで
$ svn co svn://svn.audioscrobbler.net/misc/ketama/
$ cd ketama/libketama
$ make
$ sudo make install
$ sudo ldconfig
AWS SDK for PHPインストール、セットアップ
http://aws.amazon.com/articles/4261
42. 利用手順:EC2側の環境構築
PHP(CLI)で接続
$ php test.php
key:106:40:43 is stored to example.mayg1j.0001.apne1.cache.amazonaws.com val=1 code=0
key:206:40:43 is stored to example.mayg1j.0001.apne1.cache.amazonaws.com val=1 code=0