Redis output could use list of hosts
Description
Gliffy Diagrams
Activity
CorryH October 22, 2012 at 10:43 PM
Merged in pull request 222
Jordan Sissel October 16, 2012 at 10:25 PM
wow jira kind of ate my reply.
Anyway, steps:
make :host an array (:validate => array). This permits 'host => "foo"' as well as 'host => ["foo", "bar", ...]' in the config
for any host not containing a colon, append the @port
when creating a new redis connection, pick one @host entry at random.
Jordan Sissel October 16, 2012 at 10:21 PM
Make 'host' an array, if it lacks a ":" then append ":#{@port}" to it.
Choose one hostort string now at random any time there's a new connection to be made.
This has benefits that it only extends functionality of existing attributes. First step is changing :validate => :string to :validate => :array, which still accepts single values in the config (yay!)
CorryH October 16, 2012 at 9:37 PM
I think this is something I can do, but I am unsure of how the backwards compatibility should be done.
Currently, there are two config vars, :host
and ort
. I could add a new array containing a list of hostname
ort
targets.
Should I override the old vars, if the new array is defined? Or is there a better way to do this?
Jordan Sissel October 16, 2012 at 8:25 PM
+1
Currently, when redis output fails, it retries on the same host. A small change could allow it to use the next host in a list of hosts.
This could eliminate the need for proxies and/or VIPs down the line which would e simpler.
A bonus would be an option to shuffle the list of hosts before using it.