TiDB 4.0 PCTA 学习笔记】2.5.2-2.5.4 3班 jinn

课程名称:TiDB 4.0 PCTA 学习笔记】2.5.2-2.5.4 3班 jinn

学习时长:40

课程收获:

课程内容:

2.5.2 System Tables

![TiDB 4.0
Database
INFORMATION_SCHEMA
METRICS_SCHEMA
PERFORMANCE_SCHEMA
mysql
test
MySQL 5.7.30
Database
informati on _ schema
per ormance_schema |796x286](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image001.png)

Mysql

Grant system tables

  • User: user accounts, global privileges, and other non-privilege columns
  • Db:dtatbae-level privileges
  • Table_priv: table-level privileges
  • Columns_priv:column-level privileges

Statistics system tables

  • Stats_buckets: the buckets of statistics
  • Stats_histograms: the histograms of statitics
  • Stats_meta

GC

Gc_delete_range

Misc

GLOBAL_VARIABLES

Tidb

INFORMATION_SCHEMA : database metadata, information about DB server

  • SESSION_VAIRABLES
  • TIDB_INDEXES
  • TIDB_HOT_REGIONS
  • TIKV_REGION_STATUS
  • TIKV_STORE_STATUS
  • SLOW_QUERY
  • CLUSTER_SLOW_QUERY
  • CLUSTER_PROCESSLIST

![Provides information about session variables, Replace SHOW SESSION VARIABLES statement
*rite lock count
t _oniy
have_ssl
I VARIABLE_VAcuE
| 32
30
134217728
18446744e737»ss1615 1
I DISABLED
18446744e737e9S4752e I |976x482](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image002.png)

![The TIDB_INDEXES table provides the INDEX information Of all tables.
I Field
TABLE _SCHERA
NON_uNIWE
KEV _NAME
I COLIN’_NAME
sug PART
INDEX CC*YENT I
INDEX ID
Type
I varchar(64)
varchar(64)
bigint(2i) unsigned I
varchar(64)
bigint(2i) unsigned
varchar(ß)
bigint(21) unsigned
vat-char (2048)
bigint(21) unsigned I
I Nun
YES
YES
I YES
YES
I Key I
Default
(null >
I cnull>
(null)
I Extra I |763x498](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image003.png)

![INFORMATION SCHEMA.TIDB HOT REGIONS
The TIDB_HOT_REGIONS table provides the hot Region information in the current TiKV instance.
I Field
TABLE_ID
I INDEX _ ID
0B _NAV,E
I TABLE _NA%E
TYPE
"AX FT_DEGREE I
REGION COUNT
F LN_BYTES
Type
bigint(2i) unsigned
biglnt(21) unsigned
varchar(64)
varchar(64)
varchar(64)
varchar(64)
bigint(21) unsigned
bigint(21) unsigned
bigint(21) unsigned
I Key I
YES
I YES
YES
YES
YES
Default
(null >
(null >
(null)
(null)
(null >
(null >
cnull>
I Extra I |940x484](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image004.png)

![CLUSTER_PROCESSLIST is the cluster system table corresponding to PROCESSLIST. It is used to
query the PROCESSLIST information of all TiDB nodes in the cluster. The table schema of
CLUSTER PROCESSLIST has one more column than PROCESSLIST, the INSTANCE column, which
stores the address of the TiDB node this row of data is from. |1052x350](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image005.png)

SQL Diagnosis Tables

  • Cluster information tables
  • Cluster monitoring tables
  • Automatic diagnosis

![The CLUSTER_INFO cluster topology table provides the current topology information of the cluster,
the version information of each instance, the Git Hash corresponding to the instance version, the
starting time of each instance. and the running time of each instance. |1043x430](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image006.png)

2.5.3 usage of pd control

![Placement Driver
Node 1
Heartbeat
Movement
Region B
Scheduling
command
Node 2
Region C
Cluster
info
Admin
Config
Scheduling
strategy |1040x536](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image007.png)

Launch method

Get pd info

  • Tiup cluster display <cluster_name>

![PD Cluster Info
Cluster info
o » cluster
Member info
o member
Member leader info
c, » member leader show
Member health info
o »health
Query TSO info
c, »tso 395181938313123110
» member
“header”: {
“cluster_id”: 6845630580324588732
“members”: (
“leader”: {
"etcd_leader-: { |930x513](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image008.png)

![tiup Ctl pd cluster
Starting component
/home/jinn/ . tiup/components/ctl/vq . 3.9/ctI pd cluster
id": 6908932739247316662, |980x155](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image009.png)

![Modify PD Member
Move leader away from the current member
» member leader resign
Migrate leader to a specified member
» member leader transfer
Set the priority to be elected as leader
member leader_priority «pd_name»
cpriority»
Delete the specified member
o »member delete name
» member delete id
// use delete with official support.
» member leader show
“name”: “pd-3”,
“member_id”: 11571984002077011040…
» member leader transfer pd-l
Success!
» member leader show
“name”: “pd•l”,
“member id”: 16920475015053859683… |961x476](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image010.png)

![Modify KV Member
Set the weight of a specific store
o store weight < leader _
weighty
Set the label kv pair of a specific store
o store label 1 <key» €value>
S store 1
“store”: {
“id”: 1,…
“labels”: [
“key”: -zone",
“value”: “1
// recommend using tiup duster edit-config
to config table
Delete the specific store
o store delete
// use delete with official support.
store label 1 zone 3
» store 1
“store”: (
“id”: 1…
“labels”: (
“key”: -zone”,
“value”: |788x556](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image011.png)

![Review Scheduler
Components in PD that generate scheduling tasks.
Each scheduler in PD serves different purposes
balance-leader-scheduler: Balances the distribution of leaders
balance-region-scheduler. Balances the distribution of peers
hot-region-scheduler: Balances the distribution of hot regions
evict-leader-(store-id): Evicts all leaders Of a node (Often used for rolling upgrades) |922x306](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image012.png)

![Scheduler Config
Schedule Performance
o leader-schedule-limit: the number of tasks scheduling the leader at the same time.
o replica-schedule-limit: the number of tasks scheduling the replica at the same time.
hot-region-schedule-limit: the number of tasks scheduling the hot Region at the same time.
merge-schedule-limit: the number of Region Merge scheduling tasks at the same time.
max-snapshot-count: the maximum number of pending peers in a single store.
o tolerant-size-ratio: the size of the balance buffer area, times of the average RegionSize.
Region Merge Limit
max-merge-region-keys: the upper limit on the key count of Region Merge.
max-merge-region-size: the upper limit on the size of Region Merge (the unit is M).
Rebalance Timer
max-store-down-time: If PD not receive heartbeats from a store within the specified period of
time, add replicas in other nodes. |1013x510](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image013.png)

![Modify Scheduler Config
Modify the config
o config set coption» evalue>
Modify these configs related to Region Merge
o
o
o
config set region-schedule-limit 28
config set replica-schedule-limit 32
config set merge-schedule-limit 24
config set tolerant-size-ratio SO
config set max-merge-region-size 20
config set max-merge-region-keys 200000 |608x441](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image014.png)

![View and Control Scheduling Operation
Display operators
o operator show
o operator show admin
o operator show leader
o operator show Region
// create by administator
// leader schedule category
// region schedule category
Add / Remove a replica of the specific Region on the specific store
o operator add add-peer
o operator add remove-peer
Schedule the leader of the specific Region to the specific store
o operator add transfer-leader |855x474](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image015.png)

![Store Limit Config
Store limit config limits the consuming speed Of operators
The default value is 15.
o Limiting the speed of two operations: adding learners/peers and deleting peers.
Store limit is a mapping in the memory, reset after the leader is switched or PD is
restarted.
Shows the speed limit of adding and deleting peers in all stores
o store limit
Shows the speed limit of adding peers in all stores.
o store limit region-add / store limit add-peer
Shows the speed limit of deleting peers in all stores.
o store limit region-remove / store limit remove-peer (>24.0.2) |893x489](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image016.png)

  • Know the concept of PD member, store, scheduler, operator
  • Know the important configs
  • Know what PD control can do

2.5.4 Advanced Features in Dashboard

![Machine generated alternative text:
·eupto10a巧(TiDBd:
$0ht-monitor
·Opent豇拥0b以驻伍№“,“|502x182](file:///C:/Users/jinn/AppData/Local/Temp/msohtmlclip1/02/clip_image017.png)

学习过程中参考的其他资料