Can TiDB use SQL code to find out the size of files stored on each node?

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

Original topic: TiDB可以使用SQL代码查到各个节点存储了多大的文件么

| username: TiDB超级萌新

Can TiDB use SQL code to find out the size of files stored on each node?

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

Why do you need to check it like this? :thinking:

| username: hey-hoho | Original post link

  1. Are you referring to all nodes or just TiKV?
  2. Does the file include only actual data files or all files related to the instance?
  3. If you are checking TiKV first, you can look at the table information_schema.tikv_store_status, but there might be some discrepancies with what you want.
| username: TiDB超级萌新 | Original post link

TiKV吧

| username: TiDB超级萌新 | Original post link

Just like the output of this command:
1705469723326

| username: TiDB超级萌新 | Original post link

Due to business needs :smiling_face_with_tear: I need to display a large amount of data from this database on the front end.

| username: hey-hoho | Original post link

In tikv_store_status, there are total capacity and available capacity, but the used capacity is not recorded.
It seems that it’s not necessary to use SQL to check; the business side can get the results through HTTP requests to PD or Prometheus.

| username: zhanggame1 | Original post link

Fetch from Prometheus

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

What is the reason for not considering Prometheus?

| username: TiDB超级萌新 | Original post link

Can it be called with Go code? I feel that the customer may not necessarily install this plugin.

| username: TiDB超级萌新 | Original post link

Thank you, everyone. Now the issue is resolved by calling the API
curl http://127.0.0.1:2379/pd/api/v1/stores

| username: dba远航 | Original post link

Glad it’s resolved.

| username: 麻烦是朋友 | Original post link

It may be needed for monitoring.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.