frank06/riak-js — Issue #106: Automatic client fail over
Author: jdonnerstag
Created: 2011-12-31 08:48:19+00:00
State: open

Hi,

does riak-js support client-side server failover. I don't want to put a proxy (e.g. nginx) in between my client and riak, but I'm happy to configure the different riak servers in my client config.

Maybe something like
var db = require('riak-js').getClient( [ {host: "riak.myhost_1", port: "8098" }, {host: "riak.myhost_2", port: "8098" }, ] );

May be each client config could have additional optional meta data for the loadbalancer, like
var db = require('riak-js').getClient( [ {servers: [ { host: "riak.myhost_1", port: "8098", prio: 1 }, {host: "riak.myhost_2", port: "8098", prio: 99 }, ] } );

And a pluggable loadbalancer would be nice as well
var db = require('riak-js').getClient( [ {servers: [ { host: "riak.myhost_1", port: "8098", prio: 1 }, {host: "riak.myhost_2", port: "8098", prio: 99 }, ]; loadbalancer: myLB } );

The loadbalancer should implement something like
- onFailure(server, err): e.g. throw an error, return the next server
- nextServer(): the algorithm to select the next server: round robin, LRU, prio based (see above)

Thanks for considering
Juergen