All Products
Search
Document Center

:How do I find the data node and SLOT where the keys are located?

Last Updated:Dec 29, 2020

Overview

Apsaradb for Redis requires that the keys must be in the same Hash SLOT for some commands. Apsaradb for Redis uses the Hash Tag service to calculate the Hash value of a Tag to determine the node to which the key is assigned. However, misuse of Hash tags can easily lead to data skew. Therefore, proceed with caution. This article describes how to view the SLOT SLOT on which data node the key is stored.

Detail

  1. Connect to the apsaradb for Redis instance. For more information, see log on to apsaradb for DMS.
  2. Run the following command to check the SLOT on which data node the key is stored:
    info key {[$Key1]}:[$Key2]
    Note:
    • [$Key1] is the key part to be hashed.
    • [$Key2] is the key without hashing.

  3. You can also run the following command to obtain the SLOT numbers.
    cluster keyslot {[$Key1]}:[$Key2]

Application scope

  • ApsaraDB for Redis