Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip redis master when it is in blacklisted range
When connecting to redis via proxy endpoints (such as AWS ElastiCache) nchan will retrieve masters and slaves from each connected node eg. > master_host:alias.cluster.0001.internal.use1.cache.amazonaws.com specified in the upstream block. If this hostname resolves to redis internal network that the client do not have access to, connection to master fails and nodeset_examine() will never mark the system ready. Since we can't connect to that internal network it does not make sense to connect to it, hence we should be able to blacklist the master, just like we do with slaves. With that in mind we must accept the fact that we cannot autodiscover nodes from networks nchan can't connect to. Still we should be able to configure each nodes manually in the upstream block, eg.: ``` upstream redis_master { nchan_redis_discovered_ip_range_blacklist 10.31.0.0/16; nchan_redis_server PRIMARY_ENDPOINT; nchan_redis_server READER_ENDPOINT; } nchan_redis_namespace "nchan"; nchan_redis_pass redis_master; nchan_redis_pass_inheritable on; ``` This makes it possible to connect to redis ha systems via reverse proxy, such as HAProxy as long as all nodes are species in the upstream block, or the reverse proxy can load-balance connections properly.
- Loading branch information