Skip to content

cortex redis client fails to connect  #3290

@zswanson

Description

@zswanson

Describe the bug
Using the downstream Loki build 1.6.1 which references cortex at github.com/cortexproject/cortex v1.2.1-0.20200803161316-7014ff11ed70 I was able to configure redis cache connections to my AWS ElastiCache redis cluster with this configuration:

chunk_store_config:
  chunk_cache_config:
    redis:
      endpoint: master.myredis-endpoint.use1.cache.amazonaws.com:6379
      expiration: 24h
      enable_tls: true

With this config loki connects to the remote redis and writes/reads keys.

I temporarily pulled fom loki master that uses github.com/cortexproject/cortex v1.3.1-0.20200923132904-22f2efdc1339 and no configuration of redis client seems able to connect.

level=error ts=2020-10-06T23:00:23.0679782Z caller=redis_cache.go:28 msg="error connecting to redis" name=store.index-cache-read.redis err="read tcp 172.17.0.2:33452->XX.XX.XX.XX:6379: i/o timeout"

Using the exact same application config but simply swapping versions I am able to reproduce this easily. The Loki project directly uses the Cortex redis client as far as I can tell, so the bug seems to originate here.

To Reproduce
Steps to reproduce the behavior:

  1. configure cortex at 1.3.1-0.20200923132904-22f2efdc1339 to connect to a remote redis (5.0.6 on elasticache), preferably with tls enabled
  2. observe that it cannot connect, with an error about timeout

Expected behavior
In the correct path, the cortex redis client establishes a connection and there is no error message, and I can see client connections and command activity on redis.

Environment:

  • Infrastructure: AWS ECS Fargate and local docker for testing
  • Deployment tool: ECS

Storage Engine

  • [ X] Chunks - S3

Additional Context

level=info ts=2020-10-06T23:00:22.9636273Z caller=main.go:124 msg="Starting Loki" version="(version=master-76e73d7, branch=master, revision=76e73d7c)"
level=info ts=2020-10-06T23:00:22.964309Z caller=server.go:225 http=[::]:3100 grpc=[::]:9095 msg="server listening on addresses"
level=info ts=2020-10-06T23:00:22.9647101Z caller=modules.go:408 msg="RulerStorage is not configured in single binary mode and will not be started."
level=warn ts=2020-10-06T23:00:22.9669347Z caller=experimental.go:19 msg="experimental feature in use" feature="Redis cache"
level=info ts=2020-10-06T23:00:22.9670881Z caller=memberlist_client.go:349 msg="Using memberlist cluster node name" name=9bb852e8ddb0-a59d07a9
level=error ts=2020-10-06T23:00:23.0679782Z caller=redis_cache.go:28 msg="error connecting to redis" name=store.index-cache-read.redis err="read tcp 172.17.0.2:33452->XX.XX.XX.XX:6379: i/o timeout"
level=warn ts=2020-10-06T23:00:23.0694413Z caller=experimental.go:19 msg="experimental feature in use" feature="Redis cache"
level=error ts=2020-10-06T23:00:23.1719148Z caller=redis_cache.go:28 msg="error connecting to redis" name=chunksredis err="read tcp 172.17.0.2:33454->XX.XX.XX.XX:6379: i/o timeout"

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