From 8093f1bc8a54c4f205460d4fbc1706f45bb6a195 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Wed, 16 Jun 2010 13:32:54 +0200 Subject: accept multiples hosts so we don't always hit the same node --- lib/Net/Riak.pm | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'lib/Net/Riak.pm') diff --git a/lib/Net/Riak.pm b/lib/Net/Riak.pm index fa54e2e..1fb8c21 100644 --- a/lib/Net/Riak.pm +++ b/lib/Net/Riak.pm @@ -48,7 +48,31 @@ sub bucket { =item B -Hostname or IP address (default 'http://127.0.0.1:8098') +URL of the node (default 'http://127.0.0.1:8098'). If your ring is composed with more than one node, you can configure the client to hit more than one host, instead of hitting always the same node. For this, you can do one of the following: + +=over 4 + +=item B + + my $riak = Net::Riak->new( + host => [ + 'http://10.0.0.40:8098', + 'http://10.0.0.41:8098' + ] + ); + +=item B + + my $riak = Net::Riak->new( + host => [ + {node => 'http://10.0.0.40:8098', weight => '0.2'}, + {node => 'http://10.0.0.41:8098', weight => '0.8'} + ] + ); + +=back + +Now, when a request is made, a node is picked at random, according to weight. =item B -- cgit v1.2.3