【 TiDB 使用环境】生产环境
【 TiDB 版本】7.1.5
【遇到的问题:问题现象及影响】
想通过API的方式在dashboard上获取概况、集群信息、TopSQL、SQL语句分析、慢查询等信息,然后嵌套到别的地方。
5.3.3版本可通过类似于http://127.0.0.1:2379/dashboard/api/slow_query/list的方式获取。但7.1.5版本执行报认证失败等错误。
Kongdom
(Kongdom)
2024 年9 月 9 日 11:03
2
浏览器按F12之后,点击对应页面,就能看到请求地址了。
Kongdom
(Kongdom)
2024 年9 月 9 日 11:29
3
看这里的说明,可以参照步骤三,然后获取到所有的接口清单
# Contributing to TiDB Dashboard
Thanks for your interest in contributing to TiDB Dashboard! This document outlines some of the conventions on building, running, and testing TiDB Dashboard, the development workflow, commit message formatting, contact points and other resources.
If you need any help (for example, mentoring getting started or understanding the codebase), feel free to reach out on the [TiDB Internals forum](https://internals.tidb.io/).
## Setting up a development workspace
The following steps are describing how to develop TiDB Dashboard by running a self-built and standalone TiDB Dashboard server along with a separated TiDB cluster ([TiDB] + [TiKV] + [PD]). TiDB Dashboard cannot work without a TiDB cluster.
Although TiDB Dashboard can also be integrated into [PD], this form is not convenient for developing. Thus we will not cover it here.
### Step 1. Start a TiDB cluster
[TiUP](https://docs.pingcap.com/tidb/stable/tiup-overview) is the official component manager for [TiDB]. It can help you set up a local TiDB cluster in a few minutes.
Download and install TiUP:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
This file has been truncated. show original
或者来这里扒拉源码
This repository contains both Dashboard HTTP API and Dashboard UI. Dashboard HTTP API is placed in pkg/
directory, written in Golang. Dashboard UI is placed in ui/
directory, powered by React.
// Copyright 2024 PingCAP, Inc. Licensed under Apache-2.0.
package slowquery
import (
"fmt"
"net/http"
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/joomcode/errorx"
"go.uber.org/fx"
"github.com/pingcap/tidb-dashboard/pkg/apiserver/user"
"github.com/pingcap/tidb-dashboard/pkg/apiserver/utils"
"github.com/pingcap/tidb-dashboard/pkg/tidb"
commonUtils "github.com/pingcap/tidb-dashboard/pkg/utils"
"github.com/pingcap/tidb-dashboard/util/rest"
)
This file has been truncated. show original
都已经看过了,这些信息跟5.3.3版本的api接口一致。
但7.1.5版本通过该接口访问直接报认证错误,不知道高版本在哪儿个地方调整过。
Jasper
(Jasper)
2024 年9 月 9 日 14:18
5
新版本对登陆密码进行非对称加密的的步骤
参考下这个帖子
新版本增加了对登陆密码进行非对称加密的的步骤。
token 的获取可以参考登录界面的登录流程:
通过 api 获取 /api/user/login_info 获取公钥等信息
通过 api /api/user/login 进行登录,payload 为 username 和 password,如果第一步存在公钥,则需要使用公钥对 password 进行加密
参考代码:
1 个赞
system
(system)
关闭
2024 年9 月 16 日 14:19
6
此话题已在最后回复的 7 天后被自动关闭。不再允许新回复。