[Heroku] Redis 사용하기
Heroku에서 Redis를 사용하여 데이터를 관리합니다.
Environment
- heroku/7.59.2
- darwin-x64
- node-v12.21.0
Install
Heroku 공식문서에 있는 Heroku Redis
를 사용했습니다.
Connection Limit이 20으로 준수하며, 다른 벤더에는 없는 분석 기능을 제공하기 때문입니다.
Heroku Redis https://devcenter.heroku.com/articles/heroku-redis
-
https://dashboard.heroku.com/apps 에 접속한 후 DB 용 앱을 생성합니다.
-
앱의 이름을 설정하고 앱을 생성합니다.
-
Resources
탭에서Find more add-ons
버튼을 클릭합니다. -
Heroku Redis
를 클릭합니다. -
Install Heroku Redis
을 클릭하여 설치합니다. -
생성된 Redis App의
Resources
탭에서 Redis가 성공적으로 설치되었음을 확인할 수 있습니다.해당 아이콘을 클릭하여
Settins
-View Credentials
를 클릭하시면 Redis 설정을 확인할 수 있습니다.
Access
Heroku의 Redis CLI를 이용하여 Redis에 접근할 수 있습니다.
$ heroku redis:cli -a <redis_app_name>
Connecting to redis (REDIS_TLS_URL, REDIS_URL):
[호스트주소]:[포트번호]> exit
Spring Application과 연동하기
heroku config
명령어를 사용하여 REDIS URL을 확인합니다.
$ heroku config -a <redis_app_name>
REDIS_URL: redis://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111
[Heroku] Spring Boot Application 배포를 참고하여 Spring Application의 Heroku 설정에 Redis 설정을 추가합니다.
Date: December 15, 2021
Tags:
Heroku