Skip to content

Fix Redis cluster hostname announcement using FQDN#100

Open
fonsecas72 wants to merge 1 commit intoOT-CONTAINER-KIT:masterfrom
fonsecas72:fix-cluster-mode-k8s
Open

Fix Redis cluster hostname announcement using FQDN#100
fonsecas72 wants to merge 1 commit intoOT-CONTAINER-KIT:masterfrom
fonsecas72:fix-cluster-mode-k8s

Conversation

@fonsecas72
Copy link

Redis cluster nodes were announcing themselves with short hostnames (e.g., my-redis-leader-0) instead of FQDNs, preventing proper cluster communication.

Changed POD_HOSTNAME=$(hostname) to POD_HOSTNAME=$(hostname -f) in the Redis entrypoint script to use the fully qualified domain name (e.g., my-redis-leader-0.my-redis-leader-headless.my-redis-namespace.svc.cluster.local).

Redis cluster nodes can now discover and communicate with each other regardless of namespace

@fonsecas72 fonsecas72 force-pushed the fix-cluster-mode-k8s branch 2 times, most recently from 1b4aea1 to fb6205d Compare September 8, 2025 11:58
Signed-off-by: Hugo Fonseca <hugo.fonseca@betvictor.com>
@fonsecas72 fonsecas72 marked this pull request as ready for review September 8, 2025 14:06
@drivebyer
Copy link
Collaborator

It fixed by OT-CONTAINER-KIT/redis-operator#1489 which use init-config init container

@fonsecas72
Copy link
Author

thanks @drivebyer it wasn't clear for me. I'll give the last version a try

@fonsecas72
Copy link
Author

Getting this with the default redis v7.0.15

  1:M 11 Sep 2025 12:57:40.700 # Server initialized
  1:M 11 Sep 2025 12:57:40.701 * Reading RDB base file on AOF loading...
  1:M 11 Sep 2025 12:57:40.701 # Can't handle RDB format version 12
  1:M 11 Sep 2025 12:57:40.701 # Error reading the RDB base file appendonly.aof.5.base.rdb, AOF loading aborted
  1:M 11 Sep 2025 12:57:40.701 # Unrecoverable error reading the append only file appendonly.aof.5.base.rdb: Invalid argument

After changing to redis v7.4.5...

i'm getting

*** FATAL CONFIG FILE ERROR (Redis 7.4.5) ***
Reading the configuration file, at line 21
>>> 'cluster-announce-ip'
wrong number of arguments

At first (sometimes) and then it fixes by itself. Same behaviour i was having with this PR and why i put the loop in it.

Do you have any suggestion on how to fix it? Maybe some param i might not be setting?
@drivebyer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants