목차
- Redis 버전 6 vs 7
- AWS ElastiCache Redis 매커니즘
- EC2에서 Redis - cluster 연결 방법
Redis 버전 6 vs 7
- ElastiCache Redis에서 7.0.5 버전과 6.2.6 버전을 지원한다.
- 7.0.2 버전이 22.06.12에 릴리즈되었다.
- 실제 redis github issues 페이지에서 7 버전이 unstable 하다는 의견이 많다.
- 7 버전 릴리즈가 된지 1년도 안 지났으므로 6.2.6 버전을 선택.
AWS ElastiCache Redis 매커니즘
- AWS에서 캐쉬로 제공해주는 redis의 매커니즘은 local에서 접속하는 것을 배제하고 설계하였다.
- ec2에서 직접 접근하는 것을 추천하고 만약에 local에서 접속해야 한다면, site to site VPN과 Direct Connect 서비스로 접속할 수 있다. 그런데 해당 aws 서비스는 클라우드를 이용하지 않고 물리 서버를 운영할 때 local에서 접속할 수 있게 해주는 서비스이다.
- 또한, 만약에 에러가 발생해 에러를 보고 싶으면 CloudWatch에서 로그를 볼 수 있도록 설계되었다.
AWS ElastiCache Redis 특징
- Redis는 인메모리이다.
- 기본적으로 휘발성 데이터이다.
AWS ElastiCache Redis 테스트 방법
- local에서는 redis를 직접 설치해서 test한다.
- 운영되는 redis 서버에 접속하고 싶을 때에는 session manager로 local 터미널 혹은 aws console에서 접속할 수 있다.
EC2에서 Redis - cluster 연결 방법
- EC2 접속 - session manager
EC2 접속 후 redis-cli 다운로드 및 설치
Amazon Linux 2
sudo amazon-linux-extras install epel -y
sudo yum install gcc jemalloc-devel openssl-devel tcl tcl-devel -y
sudo wget http://download.redis.io/redis-stable.tar.gz
sudo tar xvzf redis-stable.tar.gz
cd redis-stable
sudo make BUILD_TLS=yes
EC2 접속 후 redis에 연결(ElastiCache Redis에 암호화 설정이 되어 있는 경우)
src/redis-cli -c -h [cluster-endpoint] --tls -p [port number]
src/redis-cli -c -h service-redis-cluster-0001-001.service-redis-cluster.xxxxxx.xxxx.cache.amazonaws.com --tls -p 6379
Redis 명령어 실행 테스트
set a "hello" // Set key "a" with a string value and no expiration
OK
get a // Get value for key "a"
"hello"
get b // Get value for key "b" results in miss
(nil)
set b "Good-bye" EX 5 // Set key "b" with a string value and a 5 second expiration
"Good-bye"
get b // Get value for key "b"
"Good-bye" // wait >= 5 seconds
get b (nil) // key has expired, nothing returned
quit // Exit from redis-cli
References
1. Redis 버전
https://github.com/redis/redis/issues/10981
http://redisgate.kr/redis/introduction/redis_release7.php
http://redisgate.kr/redis/introduction/redis_release6.php
2. AWS ElastiCache Redis 매커니즘
https://docs.aws.amazon.com/ko_kr/AmazonElastiCache/latest/red-ug/elasticache-vpc-accessing.html
https://docs.aws.amazon.com/ko_kr/AmazonElastiCache/latest/red-ug/GettingStarted.CreateCluster.html
https://docs.aws.amazon.com/ko_kr/AmazonElastiCache/latest/red-ug/SubnetGroups.Creating-gs.html
https://docs.aws.amazon.com/ko_kr/AmazonElastiCache/latest/red-ug/set-up.html
https://docs.aws.amazon.com/ko_kr/AmazonElastiCache/latest/red-ug/WhatIs.Components.html
'AWS' 카테고리의 다른 글
[Elastic Beanstalk] 애플리케이션 버전 할당량 도달 이슈 (0) | 2023.01.11 |
---|---|
VPC 최종 구조 및 구조 설명 (0) | 2022.12.20 |
VPC + rds private access remotely + Amazon Client VPN + tunnelblick (0) | 2022.12.20 |
invalid fetch size(feat. Amazon Aurora) (0) | 2022.11.22 |
Amazon Aurora with Custom url(domain) 연결 안되는 이슈 (0) | 2022.11.22 |