아직 redis-cli 설치가 안되어있다면 redis-cli 설치를 참고해주세요
redis.0001.apn.cache..amazonaws.com:6379> info keyspace
# Keyspace
db0:keys=23976,expires=2023,avg_ttl=125758665
redis.0001.apn.cache..amazonaws.com:6379> keys *
1) "EmployeeName:Tom Johnson"
2) "ZipCode:67410"
3) "EmployeeName:Tom Hanks"
4) "EmployeeName:Tom Thumb"
5) "ZipCode:15206"
keys 명령어 사용시 주의점: 운영환경에서는 신중히 사용할 것 !!
Warning: consider KEYS as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This command is intended for debugging and special operations, such as changing your keyspace layout. Don't use KEYS in your regular application code. If you're looking for a way to find keys in a subset of your keyspace, consider using SCAN or sets.
redis.0001.apn.cache..amazonaws.com:6379> get "EmployeeName:Tom Johnson"
(error) WRONGTYPE Operation against a key holding the wrong kind of value
redis.0001.apn.cache..amazonaws.com:6379> type "EmployeeName:Tom Johnson"
hash
string : get <key>
hash : hgetall <key>
lists : lrange <key> <start> <end>
sets : smembers <key>
sorted sets : ZRANGEBYSCORE <key> <min> <max>
데이터 타입에 따른 더 다양한 명령어는 Redis 공식문서 참고
redis.0001.apn.cache..amazonaws.com:6379> hgetall "EmployeeName:Tom Johnson"
1) "_class"
2) "com.mycompany.employee.EmployeeName"
3) "name"
4) "Tom Johnson"
5) "id"
6) "2267849"
redis.0001.apn.cache..amazonaws.com:6379> hget "EmployeeName:Tom Johnson" name
"Tom Johnson"
[AWS/SQS] cloudwatch datapoint 조회하기 (2) | 2022.12.29 |
---|---|
MariaDB로 AWS Aurora 연동시 readOnly 트랜잭션이 writer 쪽에서 실행되는 현상 분석 (0) | 2022.12.26 |
[AWS] EC2 에서 Elasticache(Redis 클러스터) 접속하기 (0) | 2022.05.26 |
[AWS] SQS와 Lambda를 이용하여 DLQ 처리하기 (0) | 2022.05.19 |
[Git] 특정 기간동안 author 별 커밋 건수 확인하기 (0) | 2022.05.17 |