phpredis returns "Couldn't map cluster keyspace using any provided seed" error

5.3k Views Asked by At

phpredis returns "Couldn't map cluster keyspace using any provided seed" error when trying to connect to AWS ElasticCache for Redis cluster with tls/ssl turned on.

Everything is working fine if the AWS ElasticCache for Redis cluster has no tls/ssl turned on.

I am running my code in an EC2 within same vpc and subnet like the Redis-cluster.

Here is my connection code from php

$this -> redis = new RedisCluster(null, Array('tls://url1.10j6zb.aps1.cache.amazonaws.com:6379','tls://url2.10j6zb.aps1.cache.amazonaws.com:6379'));

Any idea how to resolve this?

1

There are 1 best solutions below

0
On

Apologies, this is not a reply specifically about TLS

I ran into this myself under PHP REDIS 2.2.8 on PHP 5.6 and I could reproduce when basically making a cluster in AWS with a single shard, as soon as I added two shards the issue went away. I could also re-create this using a single redis node in cluster mode, with itself as its only node.

docker-compose.yml

redis_cluster_of_one:
  container_name: redis_cluster_of_one
  image: bitnami/redis-cluster:latest
  environment:
    ALLOW_EMPTY_PASSWORD: "yes"
    REDIS_NODES: "redis_cluster_of_one"
    REDIS_CLUSTER_CREATOR: "yes"
    REDIS_CLUSTER_REPLICAS: "1"
  ports:
    - "6379:6379"
  volumes:
    - redis_cluster_of_one:/bitnami

volumes:
  redis_cluster_of_one:
    driver: local

I had already been testing locally with a cluster of six, but the single sharded AWS cluster failed me.