#  PD - Cluster Information And Status Management
![left](./student-guide/diagram/tikv-store-status-relationship-v1.drawio.png)
-------------------------------------------------------------
Scheduling relies on the collection of information for the entire cluster. In simple terms, scheduling needs to know the status of each TiKV node and the status of each region. The TiKV cluster reports two class messages to PD, TiKV node information and region information:
- Each TiKV node will periodically report the status information of the node to PD
- The leader of each Raft Group regularly reports the status of the region to the PD

PD continuously collects the entire cluster information via the Store or Leader heartbeat packet, and generates a sequence of scheduled actions based on this information and scheduling policies. Each time a heartbeat packet is received from the region leader, PD Checking if there are any pending operations in the region, and then return the required operation to the region leader through the heartbeat packet's reply message, and monitors the execution results in the heartbeat packet later.

Status information includes:
- Up: Indicates that the current store is in a state where the service is available.
- Disconnect: When the heartbeat information of the PD and TiKV is lost for more than 20 seconds, the status of the TiKV will change to - Disconnect state, and the TiKV will change to Down status when the time specified by max-store-down-time exceeds the time specified by max-store-down-time.
- Down: Indicates that the TiKV has lost connection with the cluster for more than the time specified by max-store-down-time, which is 30 minutes by default. After this time has elapsed, the corresponding TiKV will go down, and replica of each region will begin to be replenished on the surviving TiKVs.
- Offline: When a TiKV is manually offline via pd-ctl, the TiKV will become Offline. This status is only an intermediate state of TiKV offline, and the TiKV in this state will perform the transfer and region balance operations of the leader When the leader_count/region_count (obtained in pd-ctl) both show that transfer or balance is complete, the TiKV will change from Offline to Tombstone status. In the Offline state, it is forbidden to shut down the TiKV service and the physical server on which it resides.
- Tombstone: Indicates that the TiKV is completely offline and can be safely cleaned up using the remove-tombstone interface.