TiKV cluster has only one leader, and each region also has only one

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tikv 集群只有一个leder,region 也是只有一个

| username: suqingbin0315

[TiDB Usage Environment] Production Environment
[TiDB Version] Cluster version: v6.1.1
[Reproduction Path] tiup ctl:v6.6.0 tikv --host 192.168.1.1:20160 raft region --all-regions
Using the tikv-ctl command also shows only one
[Encountered Problem: Problem Phenomenon and Impact]
[Resource Configuration] Three PD, three TiKV, no TiDB
[Attachment: Screenshot/Log/Monitoring]

| username: Kongdom | Original post link

:sweat_smile: So what do you want to ask?

| username: suqingbin0315 | Original post link

Is this normal?

| username: suqingbin0315 | Original post link

This region has no start key or end key.
tiup ctl:v6.6.0 tikv --host 172.1.1.1:20160 raft region --all-regions
Starting component ctl: /root/.tiup/components/ctl/v6.6.0/ctl tikv --host 172.1.1.1:20160 raft region --all-regions
{
“region_infos”: {
“2”: {
“region_id”: 2,
“region_local_state”: {
“region”: {
“id”: 2,
“start_key”: “”,
“end_key”: “”,
“region_epoch”: {
“conf_ver”: 5,
“version”: 1
},
“peers”: [
{
“id”: 3,
“store_id”: 1,
“role”: “Voter”
},
{
“id”: 6,
“store_id”: 4,
“role”: “Voter”
},
{
“id”: 7,
“store_id”: 5,
“role”: “Voter”
}
]
}
},
“raft_local_state”: {
“hard_state”: {
“term”: 13,
“vote”: 6,
“commit”: 337944
},
“last_index”: 337944
},
“raft_apply_state”: {
“applied_index”: 337944,
“commit_index”: 337944,
“commit_term”: 13,
“truncated_state”: {
“index”: 337942,
“term”: 13
}
}
}
}
}

| username: Kongdom | Original post link

Normally, with only one region, it’s impossible to have one-third of the leader region on each node. If there are 3 regions, each node should have 1 leader and 3 regions on each node.

| username: suqingbin0315 | Original post link

But my data is a lot, all placed in one region, isn’t there a hotspot issue?

| username: suqingbin0315 | Original post link

store size: 2.6G

| username: Kongdom | Original post link

How about looking inside this?

| username: WalterWj | Original post link

When starting tidb-server normally, there will be multiple regions after bootstrapping.

| username: Kongdom | Original post link

:thinking: Why is this related to tidb-server?

| username: 考试没答案 | Original post link

Has it started successfully? How many regions are there now?
Continuing to follow.

| username: suqingbin0315 | Original post link

tiup display shows that the cluster is started normally.

| username: suqingbin0315 | Original post link

The startup was successful, but the entire cluster has only one region, which is very strange.

| username: 考试没答案 | Original post link

Are you currently using an empty database?
Why don’t you try inserting some data and see?

| username: suqingbin0315 | Original post link

store size: 2.6G There is data? I didn’t use the TiDB server, only deployed PD and TiKV, using TiKV for KV storage.

| username: 考试没答案 | Original post link

Playing like this. In what scenario?

| username: Kongdom | Original post link

Scroll down, there is a leader distribution.

| username: suqingbin0315 | Original post link

There is only one leader, randomly on one of the three machines.

| username: Kongdom | Original post link

The region is only 80M, which hasn’t reached the size for splitting. It will split into 2 regions at 144MiB, and the highest value is only 143, just a bit short of splitting. So, the displayed result seems normal, and there is only one region in the cluster.

| username: suqingbin0315 | Original post link

OK, thanks.