1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Redis の中身をチェックする方法

Posted at

Redis がきちんと使われているかの確認方法

前提は Amazon Linux 2 で、PHP7.3, php-pearl-redis を使っている場合。
EC2+RDS+ElastiCache 環境。

まずは、Redis CLI をインストール。
僕の場合は、php-pearl-redis しかインストールしていなかったので、redis を EPEL からインストール。

$ sudo yum install redis

Redis にログイン。
ElastiCache の Redis インスタンスの設定は開発サーバーな小さいインスタンス。

$ redis-cli -h XXXX.XXXXX.XX.9999.apne1.cache.amazonaws.com

info keyspace を実行

XXXX.XXXXX.XX.9999.apne1.cache.amazonaws.com:6379 > info keyspace
# Keyspace
db0:keys=228,expires=114,avg_ttl=394907452
db2:keys=5,expires=5,avg_ttl=6607002
db3:keys=268,expires=134,avg_ttl=400919933
db4:keys=2,expires=1,avg_ttl=397361047
db5:keys=2,expires=2,avg_ttl=7178812

これで、どの database で key がいくつ使われているか見ることができる。
僕の場合は、ElastiCache の特定 DB のクリアを確認したかったので、これで十分だった。

以上。

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?