Tyk gateway connecting to redis cluster

I’m trying to connect tyk-gateway or tyk-hybrid v2.3.8 (tried both) to a redis cluster 4.0.1. The cluster consists of 3 master and 6 slave nodes.
The config:

"storage": {
    "type": "redis",
    "enable_cluster": true,
    "hosts" : {
        "10.10.10.59": "7001",
        "10.10.10.61": "7002",
        "10.10.10.58": "7003",
        "10.10.10.60": "7004",
        "10.10.10.59": "7005",
        "10.10.10.61": "7006",
        "10.10.10.58": "7007",
        "10.10.10.60": "7008",
        "10.10.10.59": "7009"
    },
    "username": "",
    "password": "test123",
    "database": 0,
    "optimisation_max_idle": 500

If I specify 3 to 9 of the cluster nodes I get the following message:

time=“Sep 7 13:33:49” level=info msg=“–> Using clustered mode”
time=“Sep 7 13:33:49” level=info msg=“Connection dropped, connecting…”
time=“Sep 7 13:33:49” level=info msg=“–> Using clustered mode”

tyk doesn’t continue at this point.

If I specify only 1 or 2 redis nodes then tyk does continue and listens to incoming requests. However the error message I get is:

time=“2017-09-07T13:40:14Z” level=error msg=“Transacton failed: dial tcp: address tcp/7001@17001: unknown port”

7001 is the port of one redis node and 17001 is the internal redis-bus-port that tyk should not worry about.

Normally a redis client with cluster support only needs one node to get the info of the whole cluster. What do I have to specify for tyk?

Are you running in docker?

Tyk needs all redis nodes. The client doesn’t work that way.

If running in docker you might need to set the environment variable:

REDIGOCLUSTER_SHARDCOUNT=128

(Or a higher value).

This can prevent the lock.

Yes, I use docker. 128 didn’t work for me but 256 works!
There’s still one “Transacton failed: dial tcp: address tcp/7001@17001: unknown port” on startup but doesn’t show up again. I haven’t done any redis failover/failure tests yet though.