I know at standalone instance , it works ok .
But at redis cluster, can multi set command on different slots ?
NO. You cannot run command in Redis cluster where keys belong to multiple slots.
You can use hash tags to do multiple key operations in cluster mode.
Related
Can Redis run in cluster mode enabled but with single instance. It seems we get cluster status as fail when we try to deploy with single node because no slots are added to it.
https://serverfault.com/a/815813/510599
I understand we can manually add SLOTS after deployment. But I wonder if we can modify Redis source code to make this change.
Redis by default have 16 databases that can be selected by using SELECT command.
But as per the docs, https://redis.io/commands/select,
When using Redis Cluster, the SELECT command cannot be used, since
Redis Cluster only supports database zero. In the case of a Redis
Cluster, having multiple databases would be useless and an unnecessary
source of complexity.
As per redis docs, cluster/HA is achieved by
cluster - https://redis.io/topics/cluster-tutorial
sentinel -
https://redis.io/topics/sentinel.
I am clear that Redis Cluster only supports database zero, but I couldn't get the info anywhere to check the support for multiple databases in Sentinel setup with multiple nodes?
Any reference to this would be helpful. Thanks!
With sentinel setup, you can have multiple databases.
Redis Sentinel is only used to provide HA for Redis, it doesn't change Redis in any way. And you can use this Redis as the single instance Redis without sentinel.
I am using nutcracker in my application to fetch data from Redis nodes.
Just wanted to know whether it supports multi get or it internally fetches all keys one by one.
Yes it does.
You can find all the Redis commands that twemproxy supports here
As we known, redis cluster have 16384 hash slots.when redis client connect to redis cluster, how redis client to connect real save data redis node?
The rule is quite simple, redis use CRC16(key) % 16384 to determine which slot will a key go in. If you want to do everything by yourself, you just need to calculate every key's crc16.
But generally, you don't need to do these by yourself. At the moment, almost every well-known client, like jedis, predis,StackExchange.Redis , supports the cluster mode.
I'm connecting to a redis cluster node using
redis-cli -c -p 7001
When I issue info command or dbsize command, I get the count of keys that only reside on that node, and not the count of all the keys across all the nodes in my cluster.
However, if I ask for a key which doesn't reside on this node, it gets me the key from that node.
What if I want keys * to yield all keys from all the available nodes?
When talking to a Redis instance of any kind, you are only talking to that specific instance. Thus any commands are only executed in and for that instance's context. If you want to aggregate key counts across the cluster you have to issue the command on every master node and sum the results.