Redis CLUSTER Data Structure

Redis Cluster 教育
Redis Cluster Course
Redis 定期点検/技術支援
Redis Technical Support
Redis エンタープライズサーバ
Redis Enterprise Server

CLUSTER   Data Structure

클러스터 데이터 구조를 설명한다.

이 문서는 버전 3.2.2을 기준으로 만들었다.


초기화 function: clusterInit()

structure   clusterState

NoData TypeName설명Default
1clusterNode*myselfThis nodeNULL
4intsizeNum of master nodes with at least one slot1
5dict*nodesHash table of name -> clusterNode structures
6dict*nodes_black_listNodes we don't re-add for a few seconds.
10zskiplist*slots_to_keys zslCreate()
The following fields are used to take the slave state on elections.
11mstime_tfailover_auth_timeTime of previous or next election.0
12intfailover_auth_countNumber of votes received so far.0
13intfailover_auth_sentTrue if we already asked for votes.0
14intfailover_auth_rankThis slave rank for current auth request.0
15uint64_tfailover_auth_epochEpoch of the current election.0
16intcant_failover_reasonWhy a slave is currently not able to failover. See the CANT_FAILOVER_* macros.
Manual failover state in common.
17mstime_tmf_endManual failover time limit (ms unixtime). It is zero if there is no MF in progress.0
Manual failover state of master.
18clusterNode*mf_slaveSlave performing the manual failover.
Manual failover state of slave.
19long longmf_master_offset Master offset the slave needs to start MF or zero if stil not received.
20intmf_can_start If non-zero signal that the manual failover can start requesting masters vote.
The followign fields are used by masters to take state on elections.
21uint64_tlastVoteEpochEpoch of the last vote granted.0
22inttodo_before_sleepThings to do in clusterBeforeSleep().0
23long longstats_bus_messages_sentNum of msg sent via cluster bus.0
24long longstats_bus_messages_receivedNum of msg rcvd via cluster bus.0


초기화 function: createClusterNode()

structure   clusterNode

NoData TypeName설명Default
1mstime_tctimeNode object creation time.mstime()
2charname[CLUSTER_NAMELEN]Node name, hex string, sha1-size
4uint64_tconfigEpochLast configEpoch observed for this node0
5unsigned charslots[CLUSTER_SLOTS/8]slots handled by this node
6intnumslotsNumber of slots handled by this node0
7intnumslavesNumber of slave nodes, if this is a master0
8struct clusterNode**slavespointers to slave nodesNULL
9struct clusterNode*slaveofpointer to the master node. Note that it may be NULL even if the node is a slave if we don't have the master node in our tables.NULL
10mstime_tping_sentUnix time we sent latest ping0
11mstime_tpong_receivedUnix time we received the pong0
12mstime_tfail_timeUnix time when FAIL flag was set0
13mstime_tvoted_timeLast time we voted for a slave of this master0
14mstime_trepl_offset_timeUnix time we received offset for this node0
15mstime_torphaned_timeStarting time of orphaned master condition0
16long longrepl_offsetLast known repl offset for this node.0
17charip[NET_IP_STR_LEN]Latest known IP address of this node
18intportLatest known port of this node0
19clusterLink*linkTCP/IP link with this nodeNULL
20list*fail_reportsList of nodes signaling this as failinglistCreate()

structure   clusterLink

NoData TypeName설명Default
1mstime_tctimeLink creation time
2intfdTCP socket file descriptor
3sdssndbufPacket send buffer
4sdsrcvbufPacket reception buffer
5struct clusterNode*nodeNode related to this link if any, or NULL

structure   clusterMsg

NoData TypeName설명Default
1charsig[4]Siganture "RCmb" (Redis Cluster message bus).
2uint32_ttotlenTotal length of this message
3uint16_tverProtocol version, currently set to 0.
4uint16_tnotused02 bytes not used.
5uint16_ttypeMessage type
6uint16_tcountOnly used for some kind of messages.
7uint64_tcurrentEpochThe epoch accordingly to the sending node.
8uint64_tconfigEpochThe config epoch if it's a master, or the last epoch advertised by its master if it is a slave.
9uint64_toffsetMaster replication offset if node is a master or processed replication offset if node is a slave.
10charsender[CLUSTER_NAMELEN]Name of the sender node
11unsigned charmyslots[CLUSTER_SLOTS/8]
13charnotused1[32]32 bytes reserved for future usage.
14uint16_tportSender TCP base port
15uint16_tflagsSender node flags
16unsigned charstateCluster state from the POV of the sender
17unsigned charmflags[3]Message flags: CLUSTERMSG_FLAG[012]_...
18union clusterMsgDatadata

union   clusterMsgData

NoData TypeName설명Default
1 struct {
/* Array of N clusterMsgDataGossip structures */
clusterMsgDataGossip gossip[1];
2 struct {
clusterMsgDataFail about;
3 struct {
clusterMsgDataPublish msg;
4struct {
clusterMsgDataUpdate nodecfg;

structure   clusterMsgDataGossip

NoData TypeName설명Default
5uint16_tportport last time it was seen
6uint16_tflagsnode->flags copy
7uint16_tnotused1Some room for future improvements.

structure   clusterMsgDataFail

NoData TypeName설명Default

structure   clusterMsgDataPublish

NoData TypeName설명Default
2uint32_tmessage_len We can't reclare bulk_data as bulk_data[] since this structure is nested. The 8 bytes are removed from the count during the message length computation.
3unsigned charbulk_data[8]

structure   clusterMsgDataUpdate

NoData TypeName설명Default
1uint64_tconfigEpochConfig epoch of the specified instance.
2charnodename[CLUSTER_NAMELEN]Name of the slots owner.
3unsigned charslots[CLUSTER_SLOTS/8]Slots bitmap.

<< Heartbeat 체크 부하 Data Structure Commands Introduction >>

조회수 :

Email 返事がかかってなれば、メールでお知らせします。