简体   繁体   中英

Which Redis sentinel server should I connect to while connecting to Redis?

I am new to Redis and Kubernetes and have a Kubernetes cluster setup of 3 Redis and 3 Sentinel

kubernetes % kubectl -n redis get pods
NAME         READY   STATUS    RESTARTS   AGE
redis-0      1/1     Running   0          7d16h
redis-1      1/1     Running   0          7d15h
redis-2      1/1     Running   0          8d
sentinel-0   1/1     Running   0          9d
sentinel-1   1/1     Running   0          9d
sentinel-2   1/1     Running   0          9d

I have successfully connected the sentinel and Redis-master to each other and was able to test basic HA operations using Redis-cli by exec into the pods, now I wanna connect my external java application to this Redis-cluster,

Now best to my understanding we are supposed to connect to Sentinel and Sentinel will guide us Redis-master pod where write operations can be executed.

So I had a few doubts regarding this, Can I connect to any of the sentinel servers and be able to execute my operations or should I always connect to a master? if we are connecting to a sentinel and if the master Sentinel goes down, what should be the plan of action or best practices in this regard, I have read a few blogs but can't seem to reach a clear understanding?

What should I do to be able to connect my Spring boot to connect to this cluster? I read a bit on this too and it seems I can't connect to a minikube cluster directly from my IntelliJ/local machine and need to create an image and deploy it in a same namespace, is there any workaround for this?

Thanks

You should run sentinel as a sidecar container. sentilnel container would manage the master and slave and enables HA. you should connect to master for writes and slave for reads

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM