suggestion on key hash tag commands for sharding

11 views
Skip to first unread message

Xiangrong Fang

unread,
Oct 28, 2010, 10:12:23 PM10/28/10
to redi...@googlegroups.com
for simplicity, I suggest add a few sharding related commands for redis-cluster:

SHARDBY tag

this command will record "tag" as a sharding tag. Which means any key
CONTAINING "tag" will be put into one hash slot (i.e always live on
the same machine)
it returns +OK / -ERR. Also, if a tag is already a sharding tag,
this command do nothing and return "+OK". However, when adding tag,
if there are existing keys
with this tag, these keys should be relocated to a certain hash slot.
Redis determines the actual slot internally.

UNSHARDBY tag

remove "tag" as a sharding tag, so that any key containing this tag
will be evenly distributed into the cluster. (may not be needed??)
Returns +OK if the tag is removed
and -ERR if "tag" is not a sharding tag at all.

SHARDINFO tag

view realtime info about sharding tag "tag". i.e., on which servers
are these keys CURRENTLY resides. This might be useful for
backup/restore or other maintenance tasks.
Returns "+OK IP address/port of the master of that shard", or "-ERR
Not a sharding tag".

SHARDFIND key

find the server on which the key resides. Returns "+OK ip:port
shard-tag" (shard-tag can be empty of there is none), or "-ERR Key
not find" or "-ERR no cluster setup..."

Regards,
Shannon

Reply all
Reply to author
Forward
0 new messages