Skip to content

Kubernetes Redis Cluster Returning MOVED #36

@mjquinlan2000

Description

@mjquinlan2000

Hello,

Recently, the in-memory cache for my application has become too large and it is causing my Kubernetes pods to be OOM killed. I suspect that the memory usage is also impacting my app performance. I am trying to use the Redis adapter as a caching solution with a Redis cluster I have set up on my k8s cluster. It's a StatefulSet with 6 nodes. I have verified that the cluster is set up properly and I am currently using it to cache some temporary location data for the apps.

The issue I am having is that when I try to write to the cache, it returns the error

** (Redix.Error) MOVED 866 10.8.17.53:6379
    (nebulex_redis_adapter 2.2.0) lib/nebulex_redis_adapter/command.ex:103: NebulexRedisAdapter.Command.handle_command_response/1
    (nebulex_redis_adapter 2.2.0) lib/nebulex_redis_adapter.ex:480: NebulexRedisAdapter.put/6
    (nebulex_redis_adapter 2.2.0) lib/nebulex_redis_adapter.ex:475: anonymous fn/7 in NebulexRedisAdapter.put/6
    (telemetry 1.0.0) /build/services/api/deps/telemetry/src/telemetry.erl:293: :telemetry.span/3
    (nebulex 2.3.1) lib/nebulex/cache/entry.ex:42: Nebulex.Cache.Entry.put/4

When I read from the cache, I get no such error.

Here is my configuration using all 6 Redis hostnames as possible master nodes.

config :my_app, MyApp.Cache,
  mode: :redis_cluster,
  master_nodes: [
    [
      host: "redis-cluster-0.redis-cluster-headless"
    ],
    [
      host: "redis-cluster-1.redis-cluster-headless"
    ],
    [
      host: "redis-cluster-2.redis-cluster-headless"
    ],
    [
      host: "redis-cluster-3.redis-cluster-headless"
    ],
    [
      host: "redis-cluster-4.redis-cluster-headless"
    ],
    [
      host: "redis-cluster-5.redis-cluster-headless"
    ]
  ],
  conn_opts: []

Any help would be greatly appreciated. Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions