GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  REDISDB::CLUSTER (3)

.ds Aq ’

NAME

RedisDB::Cluster - client for redis cluster

CONTENTS

SYNOPSIS



    my $cluster = RedisDB::Cluster->new( startup_nodes => \@nodes );
    $cluster->set( foo, bar );
    my $res = $cluster->get(foo);



DESCRIPTION

This module allows you to access redis cluster.

METHODS

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.

CW$self->execute($command, CW@args)

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->inc("baz");



instead of



    $cluster->execute( "set", "foo", "bar" );
    $cluster->execute( "inc", "baz" );



CW$self->random_connection

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.

CW$self->add_new_node($address[, CW$master_id])

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.

CW$self->migrate_slot($slod, CW$destination_node)

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 Specification <http://redis.io/topics/cluster-spec>.

CW$self->remove_node($node)

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.

SERVICE FUNCTIONS

    crc16($buf)

compute crc16 for the specified buffer as defined in redis cluster specification

    key_slot($key)

return slot number for the given $key

AUTHOR

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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 REDISDB::CLUSTER (3) 2015-08-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.