ROLE

    Provide information on the role of a Dragonfly instance in the context of replication, by returning if the instance is currently a or slave. The command also returns additional information about the state of the replication.

    The command returns an array of elements. The first element is the role of the instance, as one of the following three strings:

    • “master”
    • “slave”

    An example of output when dragonfly> ROLE is called in a master instance:

    The master output is composed of the following parts:

    1. An array composed of two elements array representing the connected replicas. Every sub-array contains the replica IP and replication state. For the state meanings see the replica output description below.

    The replica output is composed of the following parts:

    1. The string replica, because of backward compatibility (see note at the end of this page).
    2. The IP of the master.
    3. The current replication state, that can be connecting (the connection is in progress), full sync (the master and replica are performing a full synchronization) and (the replica is online)

    : where the first element is one of master, slave, sentinel and the additional elements are role-specific as illustrated above.