The metadata of TIDB-server is not synchronized, and only one of the three TIDBs in the cluster can query data

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

Original topic: TIDB-server的元数据没同步,集群中的3个tidb只能一个可以查到数据

| username: TiDBer_9RWh3saG

[TiDB Usage Environment] Poc
[TiDB Version] 7.5
[Reproduction Path] tiup online installation

[Encountered Problem: Problem Phenomenon and Impact]
Data written to one TiDB instance is not visible in the corresponding databases and tables on the other two TiDB instances.




WeChat Image_20240125161525
WeChat Image_20240125161537

| username: 小龙虾爱大龙虾 | Original post link

Use the “show database” statement to check, the tool has its own logic.

| username: 数据库真NB | Original post link

Check the PD and metadata information to see if they are consistent.

| username: zhanggame1 | Original post link

Use the MySQL command line to directly connect to each TiDB node to test if it’s an issue with the tool.

| username: TiDBer_9RWh3saG | Original post link

I used MySQL to connect to three TiDB instances, and two of them have issues. Did you see the screenshot?

| username: TiDBer_9RWh3saG | Original post link

The first TiDB

The other two TiDBs

| username: TiDBer_9RWh3saG | Original post link

The first TiDB

The second TiDB

The third TiDB

| username: zhanggame1 | Original post link

It’s quite strange, it should be some kind of bug. Restarting TiDB should fix it.

| username: TiDBer_9RWh3saG | Original post link

Then I’ll try restarting.

| username: TiDBer_9RWh3saG | Original post link

Restarting doesn’t help either.

| username: 裤衩儿飞上天 | Original post link

Are you using the same user to log in? If not, do they have the same permissions?

| username: 这里介绍不了我 | Original post link

It looks like he logged in as root based on the screenshot.

| username: 裤衩儿飞上天 | Original post link

There can be situations where the user is the same (multiple roots) but the host is different.

| username: 这里介绍不了我 | Original post link

If he uses the client, it should be the same user.

| username: TiDBer_9RWh3saG | Original post link

The database has only one user, ‘root’@‘%’.

| username: zhanggame1 | Original post link

After all three clients have logged in, check the CLUSTER_PROCESSLIST view to confirm that all three are logged in and not connected to other places, right?

| username: 小龙虾爱大龙虾 | Original post link

Check the logs for any errors, then look at the schema load on the Grafana TiDB panel, and finally check the problematic node with show variables like '%limit%';.

| username: 托马斯滑板鞋 | Original post link

There is a question, why are there only two PDs? Won’t this cause problems?
image
Expand the PD to three and see if it works properly :upside_down_face:

| username: 这里介绍不了我 | Original post link

This has nothing to do with it.

| username: 托马斯滑板鞋 | Original post link

Isn’t etcd inside PD? Can two etcds run normally? Who will be the leader?