Manual Reference Pages - REDISDB::CLUSTER (3)
RedisDB::Cluster - client for redis cluster
my $cluster = RedisDB::Cluster->new( startup_nodes => \@nodes );
$cluster->set( foo, bar );
my $res = $cluster->get(foo);
This module allows you to access redis cluster.
CW$self->new(startup_nodes => \@nodes)
create a new connection to cluster. Startup nodes are used to retrieve
information about all cluster nodes and slots mappings.
sends command to redis and returns the reply. It determines the cluster node to
send command to from the first key in @args, sending commands that does not
include key as an argument is not supported. If @args contains several keys,
all of them should belong to the same slot, otherwise redis-server will return
an error if some of the keys are stored on a different node.
Module also defines wrapper methods with names matching corresponding redis
commands, so you can use
$cluster->set( "foo", "bar" );
$cluster->execute( "set", "foo", "bar" );
$cluster->execute( "inc", "baz" );
return RedisDB object that is connected to some node of the cluster. Note, that
in most cases this method will return the same connection every time.
CLUSTER MANAGEMENT METHODS
The following methods can be used for cluster management to add or remove a
node, or migrate slot from one node to another.
attach node with the specified $address to the cluster. If $master_id is
specified, the new node is configured as a replica of the master with the
specified ID, otherwise it will be a master node itself. Address should be
specified as a hash containing host and port elements.
migrates specified slot to the given $destination_node from the current node
responsible for this slot. Destinations node should be specified as a hash
containing host and port elements. For details check Cluster live
reconfiguration section in the Redis Cluster
removes node from the cluster. If the node is a slave, it simply shuts the node
down and sends CLUSTER FORGET command to all other cluster nodes. If the node
is a master node, the method first migrates all slots from it to other nodes.
compute crc16 for the specified buffer as defined in redis cluster
return slot number for the given $key
Pavel Shaydo, <zwon at cpan.org>
LICENSE AND COPYRIGHT
Copyright 2011-2015 Pavel Shaydo.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
|perl v5.20.3 ||REDISDB::CLUSTER (3) ||2015-08-03 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.