cluster_data_structure
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()
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | clusterNode | *myself | This node | NULL |
2 | uint64_t | currentEpoch | 0 | |
3 | int | state | CLUSTER_OK, CLUSTER_FAIL, ... | CLUSTER_FAIL |
4 | int | size | Num of master nodes with at least one slot | 1 |
5 | dict | *nodes | Hash table of name -> clusterNode structures dictCreate(&clusterNodesDictType, NULL) | |
6 | dict | *nodes_black_list | Nodes we don't re-add for a few seconds. dictCreate(&clusterNodes BlackListDictType,NULL) | |
7 | clusterNode | *migrating_slots_to [CLUSTER_SLOTS] | ||
8 | clusterNode | *importing_slots_from [CLUSTER_SLOTS] | ||
9 | clusterNode | *slots [CLUSTER_SLOTS] | ||
10 | zskiplist | *slots_to_keys | zslCreate() | |
The following fields are used to take the slave state on elections. | ||||
11 | mstime_t | failover_auth_time | Time of previous or next election. | 0 |
12 | int | failover_auth_count | Number of votes received so far. | 0 |
13 | int | failover_auth_sent | True if we already asked for votes. | 0 |
14 | int | failover_auth_rank | This slave rank for current auth request. | 0 |
15 | uint64_t | failover_auth_epoch | Epoch of the current election. | 0 |
16 | int | cant_failover_reason | Why a slave is currently not able to failover. See the CANT_FAILOVER_* macros. CLUSTER_CANT_FAILOVER_NONE | |
Manual failover state in common. | ||||
17 | mstime_t | mf_end | Manual failover time limit (ms unixtime). It is zero if there is no MF in progress. | 0 |
Manual failover state of master. | ||||
18 | clusterNode | *mf_slave | Slave performing the manual failover. | |
Manual failover state of slave. | ||||
19 | long long | mf_master_offset | Master offset the slave needs to start MF or zero if stil not received. | |
20 | int | mf_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. | ||||
21 | uint64_t | lastVoteEpoch | Epoch of the last vote granted. | 0 |
22 | int | todo_before_sleep | Things to do in clusterBeforeSleep(). | 0 |
23 | long long | stats_bus_messages_sent | Num of msg sent via cluster bus. | 0 |
24 | long long | stats_bus_messages_received | Num of msg rcvd via cluster bus. | 0 |
clusterNode
초기화 function: createClusterNode()
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | mstime_t | ctime | Node object creation time. | mstime() |
2 | char | name[CLUSTER_NAMELEN] | Node name, hex string, sha1-size | |
3 | int | flags | CLUSTER_NODE_... | flags |
4 | uint64_t | configEpoch | Last configEpoch observed for this node | 0 |
5 | unsigned char | slots[CLUSTER_SLOTS/8] | slots handled by this node | |
6 | int | numslots | Number of slots handled by this node | 0 |
7 | int | numslaves | Number of slave nodes, if this is a master | 0 |
8 | struct clusterNode | **slaves | pointers to slave nodes | NULL |
9 | struct clusterNode | *slaveof | pointer 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 |
10 | mstime_t | ping_sent | Unix time we sent latest ping | 0 |
11 | mstime_t | pong_received | Unix time we received the pong | 0 |
12 | mstime_t | fail_time | Unix time when FAIL flag was set | 0 |
13 | mstime_t | voted_time | Last time we voted for a slave of this master | 0 |
14 | mstime_t | repl_offset_time | Unix time we received offset for this node | 0 |
15 | mstime_t | orphaned_time | Starting time of orphaned master condition | 0 |
16 | long long | repl_offset | Last known repl offset for this node. | 0 |
17 | char | ip[NET_IP_STR_LEN] | Latest known IP address of this node | |
18 | int | port | Latest known port of this node | 0 |
19 | clusterLink | *link | TCP/IP link with this node | NULL |
20 | list | *fail_reports | List of nodes signaling this as failing | listCreate() |
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | mstime_t | ctime | Link creation time | |
2 | int | fd | TCP socket file descriptor | |
3 | sds | sndbuf | Packet send buffer | |
4 | sds | rcvbuf | Packet reception buffer | |
5 | struct clusterNode | *node | Node related to this link if any, or NULL |
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | char | sig[4] | Siganture "RCmb" (Redis Cluster message bus). | |
2 | uint32_t | totlen | Total length of this message | |
3 | uint16_t | ver | Protocol version, currently set to 0. | |
4 | uint16_t | notused0 | 2 bytes not used. | |
5 | uint16_t | type | Message type | |
6 | uint16_t | count | Only used for some kind of messages. | |
7 | uint64_t | currentEpoch | The epoch accordingly to the sending node. | |
8 | uint64_t | configEpoch | The config epoch if it's a master, or the last epoch advertised by its master if it is a slave. | |
9 | uint64_t | offset | Master replication offset if node is a master or processed replication offset if node is a slave. | |
10 | char | sender[CLUSTER_NAMELEN] | Name of the sender node | |
11 | unsigned char | myslots[CLUSTER_SLOTS/8] | ||
12 | char | slaveof[CLUSTER_NAMELEN] | ||
13 | char | notused1[32] | 32 bytes reserved for future usage. | |
14 | uint16_t | port | Sender TCP base port | |
15 | uint16_t | flags | Sender node flags | |
16 | unsigned char | state | Cluster state from the POV of the sender | |
17 | unsigned char | mflags[3] | Message flags: CLUSTERMSG_FLAG[012]_... | |
18 | union clusterMsgData | data |
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 |
struct { /* Array of N clusterMsgDataGossip structures */ clusterMsgDataGossip gossip[1]; } | ping | PING, MEET and PONG | |
2 | struct { clusterMsgDataFail about; } | fail | FAIL | |
3 | struct { clusterMsgDataPublish msg; } | publish | PUBLISH | |
4 | struct { clusterMsgDataUpdate nodecfg; } | update | UPDATE |
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | char | nodename[CLUSTER_NAMELEN] | ||
2 | uint32_t | ping_sent | ||
3 | uint32_t | pong_received | ||
4 | char | ip[NET_IP_STR_LEN] | ||
5 | uint16_t | port | port last time it was seen | |
6 | uint16_t | flags | node->flags copy | |
7 | uint16_t | notused1 | Some room for future improvements. | |
8 | uint32_t | notused2 |
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | char | nodename[CLUSTER_NAMELEN] |
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | uint32_t | channel_len | ||
2 | uint32_t | message_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. | |
3 | unsigned char | bulk_data[8] |
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | uint64_t | configEpoch | Config epoch of the specified instance. | |
2 | char | nodename[CLUSTER_NAMELEN] | Name of the slots owner. | |
3 | unsigned char | slots[CLUSTER_SLOTS/8] | Slots bitmap. |
<< Heartbeat 체크 부하 | Data Structure | Commands Introduction >> |
---|
조회수 :
Email
返事がかかってなれば、メールでお知らせします。