1. 왼쪽 탭 -> Administration -> Plugins -> 'redis' 검색 -> Redis 선택
2. 오른쪽 위 'Install' 버튼 클릭
3. 오른쪽 위 'Create a Redis data source' 버튼 클릭
4. Redis data source 정보 설정하기
# redis 정보 확인
helm status {Release Name}
# Redis Release 정보 확인
NAME: my-release
LAST DEPLOYED: Sat Apr 29 16:46:46 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: redis
CHART VERSION: 17.10.1
APP VERSION: 7.0.11
** Please be patient while the chart is being deployed **
Redis® can be accessed on the following DNS names from within your cluster:
my-release-redis-master.default.svc.cluster.local for read/write operations (port 6379)
my-release-redis-replicas.default.svc.cluster.local for read-only operations (port 6379)
To get your password run:
export REDIS_PASSWORD=$(kubectl get secret --namespace default my-release-redis -o jsonpath="{.data.redis-password}" | base64 -d)
To connect to your Redis® server:
1. Run a Redis® pod that you can use as a client:
kubectl run --namespace default redis-client --restart='Never' --env REDIS_PASSWORD=$REDIS_PASSWORD --image docker.io/bitnami/redis:7.0.11-debian-11-r0 --command -- sleep infinity
Use the following command to attach to the pod:
kubectl exec --tty -i redis-client \
--namespace default -- bash
2. Connect using the Redis® CLI:
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h my-release-redis-master
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h my-release-redis-replicas
To connect to your database from outside the cluster execute the following commands:
kubectl port-forward --namespace default svc/my-release-redis-master 6379:6379 &
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379
# 비밀번호 확인
export REDIS_PASSWORD=$(kubectl get secret --namespace default my-release-redis -o jsonpath="{.data.redis-password}" | base64 -d)
echo $REDIS_PASSWORD
필수적인 정보는 Address와 Password이다. Address: my-release-redis-master.default.svc.cluster.local:6379 Password: $REDIS_PASSWORD
5. 아래에 'Save & test' 버튼 클릭 후 이미지처럼 나오면 성공
6. Dashboards 탭 -> Redis import 클릭 -> Redis 클릭
7. 연동 완료
8. 간단한 연동 테스트를 해보자. redis에 접속해서 데이터를 여러개 생성해보자.
# redis 접속
redis-cli -h 127.0.0.1 -p 6379 --askpass
# 데이터 생성
set {key} {value}