ShardedKV is a Perl module that implements an abstract interface to a sharded key-value store. The storage backends as well as the "continuum" are pluggable. "Continuum" is to mean "the logic that decides in which shard a particular key lives". Typically, people use consistent hashing for this purpose and very commonly the choice is to use ketama specifically. See below for references.
Beside the abstract querying interface, this module also implements logic to add one or more servers to the continuum and use passive key migration to extend capacity without downtime. Do make it a point to understand the logic before using it. More on that below.
my $continuum_spec = [
["shard1", 100], # shard name, weight
my $continuum = ShardedKV::Continuum::Ketama->new(from => $continuum_spec);
# Redis storage chosen here, but can also be "Memory" or "MySQL".
# "Memory" is for testing. Mixing storages likely has weird side effects.
my %storages = (
shard1 => ShardedKV::Storage::Redis->new(
redis_master_str => 'redisserver:6379',
redis_slave_strs => ['redisbackup:6379', 'redisbackup2:6379'],
shard2 => ShardedKV::Storage::Redis->new(
redis_master_str => 'redisserver:6380',
redis_slave_strs => ['redisbackup:6380', 'redisbackup2:6380'],
my $skv = ShardedKV->new(
storages => \%storages,
continuum => $continuum,
my $value = $skv->get($key);