redis-commanderでredisサーバへの操作を行えるようにする
node.jsで作られたredisマネジメントツールredis-commanderをインストールします。 GUIでredisの操作できます。
手順
$sudo yum install nodejs $sudo yum install npm $sudo npm install -g redis-commander
haproxy
redis-commanderからはローカルのhaproxyを経由してredisサーバに接続するようにします。
listen redis bind :6379 mode tcp balance source server redis1 staging-redis-1.example.internal:6379 inter 5s fall 2 rise 2 check port 6379
monitでプロセス監視を行う
プロセスの起動はmonit経由で行います。
- /etc/monit.d/staging
check process redis-commander matching "redis-commander" start program = "/usr/bin/redis-commander" as uid ec2-user and gid ec2-user stop program = "/usr/bin/killall -9 redis-commander" if 5 restarts within 5 cycles then timeout
動作確認
AWSセキュリティグループのポリシー追加
会社のIP、プロキシIPからセキュリティグループappへのtcp:8081接続を許可します。
画面を開く
http://redis-commanderをインストールしたサーバ:8081
で画面が開きます。
今回はredidのindex1〜4まで使う予定なのでmore->Add Server
より指定のindex分、接続を行っておきます。