Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable DNS/hostnames support for sentinel #1054

Open
AlievR opened this issue Aug 27, 2024 · 1 comment
Open

Enable DNS/hostnames support for sentinel #1054

AlievR opened this issue Aug 27, 2024 · 1 comment
Labels
question Further information is requested

Comments

@AlievR
Copy link

AlievR commented Aug 27, 2024

Currently, sentinel selects a redis master based on the pod's IP address. I think this is not entirely correct; it would be more correct to use DNS names.
I'm trying to do something like this:

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: sentinel-config
data:
  redis-sentinel-additional.conf: |
    daemonize no
    pidfile "/var/run/redis-sentinel.pid"
    dir "/tmp"
    port 26379
    sentinel resolve-hostnames yes
    sentinel announce-hostnames yes
    sentinel monitor mymaster redis-replication-0.redis-replication-headless.redis-test.svc.cluster.local 6379 2
    sentinel down-after-milliseconds mymaster 30000
    sentinel failover-timeout mymaster 180000
    sentinel parallel-syncs mymaster 1
---
apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: RedisSentinel
metadata:
  name: redis-sentinel
spec:
  clusterSize: 3
  podSecurityContext:
    runAsUser: 1000
    fsGroup: 1000
  pdb:
    enabled: false
    minAvailable: 1
  redisSentinelConfig:
    redisReplicationName: redis-replication
    masterGroupName: "mymaster"
    redisPort:  "6379"
    quorum: "2"
    parallelSyncs: "1"
    failoverTimeout: "180000"
    downAfterMilliseconds: "30000"
    additionalSentinelConfig: sentinel-config
  kubernetesConfig:
    image: quay.io/opstree/redis-sentinel:v7.0.12
    imagePullPolicy: IfNotPresent
    resources:
      requests:
        cpu: 101m
        memory: 128Mi
      limits:
        cpu: 101m
        memory: 128Mi

As a result, sentinel crashes with the following error:

 *** FATAL CONFIG FILE ERROR (Redis 7.2.1) ***                                                                                                              │
│ Reading the configuration file, at line 7                                                                                                                  │
│ >>> 'sentinel monitor mymaster redis-replication-0.redis-replication-headless.redis-test.svc.cluster.local 6379 2'                                         │
│ Duplicate master name. 

It is also worth noting that in crd Redis Sentinel there is no way to upload volumes.
I believe that it should generally be configured this way from the start.
Please help in solving this problem

redis-operator version: 0.18.0

@AlievR AlievR added the question Further information is requested label Aug 27, 2024
@woodliu
Copy link

woodliu commented Sep 9, 2024

@AlievR i think this operator not support this function, it just mount the senltinet config file to pod.
To use DNS, it need to change the config file for both sentinel nodes and redis nodes to announce the hostname, check this: https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/#ip-addresses-and-dns-names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants