This repository was archived by the owner on Dec 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 282
This repository was archived by the owner on Dec 16, 2024. It is now read-only.
:nxdomain when using redis cluster endpoint with large number of shards #126
Copy link
Copy link
Open
Description
This is with eredis_cluster ~> 0.5.12
When using eredis pointing to a redis cluster endpoint with large number of shards, I get error :nxdomain. The only workaround is to use a list of ip addresses.
It is because, :inet.getaddr/2 unable to handle dns lookups that result in a large answers. Note however that :inet_res.gethostbyname/1 works fine likely because it reissues the dns lookup over TCP when it finds that the first query had the truncate bit set.
Offending code here: https://github.com/wooga/eredis/blob/master/src/eredis_client.erl#L335 (line 335, and line 307)
Below is a sample iex output that shows the error
Note the :nxdomain error in the second command, same hostname works fine in the fourth command.
iex(tango@2e76e9718be1)69> :inet.getaddr('small-redis-cluster.kk5zzw.clustercfg.use1.cache.amazonaws.com', :inet)
{:ok, {10, 99, 17, 14}}
iex(tango@2e76e9718be1)70> :inet.getaddr('large-redis-cluster.kk5zzw.clustercfg.use1.cache.amazonaws.com', :inet)
{:error, :nxdomain}
iex(tango@2e76e9718be1)71> :inet_res.gethostbyname('small-redis-cluster.kk5zzw.clustercfg.use1.cache.amazonaws.com')
{:ok,
{:hostent,
'small-redis-cluster.kk5zzw.clustercfg.use1.cache.amazonaws.com', [],
:inet, 4,
[
{10, 99, 23, 178},
{10, 99, 31, 149},
{10, 99, 22, 232},
{10, 99, 6, 27},
{10, 99, 17, 14},
{10, 99, 1, 221},
{10, 99, 2, 67},
{10, 99, 1, 59}
]}}
iex(tango@2e76e9718be1)72> :inet_res.gethostbyname('large-redis-cluster.kk5zzw.clustercfg.use1.cache.amazonaws.com')
{:ok,
{:hostent, 'large-redis-cluster.kk5zzw.clustercfg.use1.cache.amazonaws.com', [],
:inet, 4,
[
{10, 99, 59, 135},
{10, 99, 57, 16},
{10, 99, 59, 160},
{10, 99, 56, 194},
{10, 99, 56, 232},
{10, 99, 57, 166},
{10, 99, 57, 110},
{10, 99, 60, 8},
{10, 99, 57, 71},
{10, 99, 59, 89},
{10, 99, 57, 36},
{10, 99, 59, 202},
{10, 99, 56, 205},
{10, 99, 57, 149},
{10, 99, 59, 14},
{10, 99, 59, 230},
{10, 99, 61, 124},
{10, 99, 61, 224},
{10, 99, 60, 182},
{10, 99, 60, 109}
]}}
Metadata
Metadata
Assignees
Labels
No labels