#!/bin/bash
case $1 in
-pd)
mysql -uroot -h127.0.0.1 -P4000 -p"" -e "SHOW CONFIG WHERE type ='pd' and name like '%$2%'"
;;
-tidb)
mysql -uroot -h127.0.0.1 -P4000 -p"" -e "SHOW CONFIG WHERE type ='tidb' and name like '%$2%'"
;;
-tikv)
mysql -uroot -h127.0.0.1 -P4000 -p"" -e "SHOW CONFIG WHERE type ='tikv' and name like '%$2%'"
;;
-tiflash)
mysql -uroot -h127.0.0.1 -P4000 -p"" -e "SHOW CONFIG WHERE type ='tiflash' and name like '%$2%'"
;;
-var)
mysql -uroot -h127.0.0.1 -P4000 -p"" -e "show variables like '%$2%';"
;;
-h)
echo "-pd show pd parameters"
echo "-tidb show tidb parameters"
echo "-tikv show tikv parameters"
echo "-tiflash show tiflash parameters"
echo "-var show itidb variables"
;;
esac
使用起来如下:
[root@xxxxx ~]# sh showparammeter.sh -tikv memory-pool-quota
mysql: [Warning] Using a password on the command line interface can be insecure.
+------+----------------------+-------------------------------+----------------------+
| Type | Instance | Name | Value |
+------+----------------------+-------------------------------+----------------------+
| tikv | 192.16.201.125:29160 | server.grpc-memory-pool-quota | 9223372036854775807B |
| tikv | 192.16.201.125:29161 | server.grpc-memory-pool-quota | 9223372036854775807B |
| tikv | 192.16.201.130:29161 | server.grpc-memory-pool-quota | 9223372036854775807B |
| tikv | 192.16.201.130:29160 | server.grpc-memory-pool-quota | 9223372036854775807B |
| tikv | 192.16.201.210:29161 | server.grpc-memory-pool-quota | 9223372036854775807B |
| tikv | 192.16.201.210:29160 | server.grpc-memory-pool-quota | 9223372036854775807B |
+------+----------------------+-------------------------------+----------------------+
[root@xxxxx ~]# sh showparammeter.sh -pd quota
mysql: [Warning] Using a password on the command line interface can be insecure.
+------+---------------------+---------------------+-------+
| Type | Instance | Name | Value |
+------+---------------------+---------------------+-------+
| pd | 172.16.201.125:2379 | quota-backend-bytes | 8GiB |
+------+---------------------+---------------------+-------+
select query sql_text,
sum_query_time,
mnt as executions,
avg_query_time,
avg_proc_time,
avg_wait_time,
max_query_time,
avg_backoff_time,
Cop_proc_addr,
digest,
(case
when avg_proc_time = 0 then
'point_get or commit'
when (avg_proc_time > avg_wait_time and
avg_proc_time > avg_backoff_time) then
'coprocessor_process'
when (avg_backoff_time > avg_wait_time and
avg_proc_time < avg_backoff_time) then
'backoff'
else
'coprocessor_wait'
end) as type
from (select substr(query, 1, 100) query,
count(*) mnt,
avg(query_time) avg_query_time,
avg(process_time) avg_proc_time,
avg(wait_time) avg_wait_time,
max(query_time) max_query_time,
sum(query_time) sum_query_time,
digest,
Cop_proc_addr,
avg(backoff_time) avg_backoff_time
from information_schema.cluster_slow_query
where time >= '2022-07-14 17:00:00'
and time <= '2022-07-15 17:10:00'
and DB = 'web'
group by substr(query, 1, 100)) t
order by max_query_time desc limit 20;
SELECT table_schema, SUM(data_length)/1024/1024 AS data_length, SUM(index_length)/1024/1024 AS index_length, SUM(data_length+index_length)/1024/1024 AS sum FROM information_schema.tables WHERE table_schema = “${schema_name}” GROUP BY table_schema;