Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 如何看1个region 分布在哪几个tikv上
May I ask how to see which TiKV instances a region is distributed on, and is it possible to know the IP and port of the TiKV instances?
Database: INFORMATION_SCHEMA
Tables: TIKV_REGION_PEERS, TIKV_REGION_STATUS, TIKV_STORE_STATUS
You can join the above three tables to get the required information.
For example, you can use the following query and add some other conditions if needed:
select r.REGION_ID, r.IS_LEARNER, r.IS_LEADER, s.ADDRESS
from TIKV_REGION_PEERS r, TIKV_STORE_STATUS s
where r.STORE_ID = s.STORE_ID
limit 2;
Generally, the pd-ctl tool is used. Refer to the official documentation: PD Control 使用说明 | PingCAP 文档中心
The correspondence information between region and store is in the TIKV_REGION_PEERS table.
Executing the region command in pdctl
>> region 2
{
"id": 2,
"start_key": "7480000000000000FF1D00000000000000F8",
"end_key": "7480000000000000FF1F00000000000000F8",
"epoch": {
"conf_ver": 1,
"version": 15
},
"peers": [
{
"id": 40,
"store_id": 3
}
],
"leader": {
"id": 40,
"store_id": 3
},
"written_bytes": 0,
"read_bytes": 0,
"written_keys": 0,
"read_keys": 0,
"approximate_size": 1,
"approximate_keys": 0
}
This topic was automatically closed 1 minute after the last reply. No new replies are allowed.