Redis CLUSTER Data Structure

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

CLUSTER   Data Structure

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

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

clusterState

초기화 function: clusterInit()

structure   clusterState

NoData TypeName설명Default
1clusterNode*myselfThis nodeNULL
2uint64_tcurrentEpoch0
3intstateCLUSTER_OK, CLUSTER_FAIL, ...CLUSTER_FAIL
4intsizeNum of master nodes with at least one slot1
5dict*nodesHash table of name -> clusterNode structures
dictCreate(&clusterNodesDictType,
NULL)
6dict*nodes_black_listNodes we don't re-add for a few seconds.
dictCreate(&clusterNodes
BlackListDictType,NULL)
7clusterNode*migrating_slots_to
[CLUSTER_SLOTS]
8clusterNode*importing_slots_from
[CLUSTER_SLOTS]
9clusterNode*slots
[CLUSTER_SLOTS]
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.
CLUSTER_CANT_FAILOVER_NONE
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


clusterNode

초기화 function: createClusterNode()

structure   clusterNode

NoData TypeName설명Default
1mstime_tctimeNode object creation time.mstime()
2charname[CLUSTER_NAMELEN]Node name, hex string, sha1-size
3intflagsCLUSTER_NODE_...flags
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]
12charslaveof[CLUSTER_NAMELEN]
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];
}
pingPING, MEET and PONG
2 struct {
clusterMsgDataFail about;
}
failFAIL
3 struct {
clusterMsgDataPublish msg;
}
publishPUBLISH
4struct {
clusterMsgDataUpdate nodecfg;
}
updateUPDATE

structure   clusterMsgDataGossip

NoData TypeName설명Default
1charnodename[CLUSTER_NAMELEN]
2uint32_tping_sent
3uint32_tpong_received
4charip[NET_IP_STR_LEN]
5uint16_tportport last time it was seen
6uint16_tflagsnode->flags copy
7uint16_tnotused1Some room for future improvements.
8uint32_tnotused2

structure   clusterMsgDataFail

NoData TypeName설명Default
1charnodename[CLUSTER_NAMELEN]

structure   clusterMsgDataPublish

NoData TypeName설명Default
1uint32_tchannel_len
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 返事がかかってなれば、メールでお知らせします。

혹시 처음이세요?
레디스게이트에는 레디스에 대한 많은 정보가 있습니다.
레디스 소개, 명령어, SQL, 클라이언트, 서버, 센티널, 클러스터 등이 있습니다.
혹시 필요한 정보를 찾기 어려우시면 redisgate@gmail.com로 메일 주세요.
제가 찾아서 알려드리겠습니다.
 
close
IP를 기반으로 보여집니다.