https://tidb.net/blog/bda86911
 

注意事项1:tidb-test 为集群名称

 

注意事项2:参数修改前与修改后备份.tiup目录

 

注意事项3:通过 tiup cluster edit-config 来修改配置参数

1、修改配置参数

tiup cluster edit-config tidb-test

2、元数据存储地址

cat ~/.tiup/storage/cluster/clusters/tidb-test/meta.yaml

3、配置文件结构

配置文件按作用域分为 global 与 local

  • global:对所有节点有效(优先级低)

  • local:只对当前节点有效(优先级高)

若在 global 配置和单个实例中存在同名配置项,那么以 local 配置的为准。

global 配置:

global:集群全局配置,可单独针对每个组件配置

 

monitored:监控服务配置,即 blackbox exporter 和 node exporter

 

server_configs:各个组件全局配置,可单独针对每个组件配置

local 配置:

pd_servers:PD 实例的配置,用来指定 PD 组件部署到哪些机器上

 

tidb_servers:TiDB 实例的配置,用来指定 TiDB 组件部署到哪些机器上

 

tikv_servers:TiKV 实例的配置,用来指定 TiKV 组件部署到哪些机器上

 

pump_servers:Pump 实例的配置,用来指定 Pump 组件部署到哪些机器上

 

drainer_servers:Drainer 实例的配置,用来指定 Drainer 组件部署到哪些机器上

 

cdc_servers:CDC 实例的配置,用来指定 CDC 组件部署到哪些机器上

 

monitoring_servers:用来指定 Prometheus 和 NGMonitoring 部署在哪些机器上,TiUP 支持部署多台 Prometheus 实例,但真实投入使用的只有第一个

 

grafana_servers:Grafana 实例的配置,用来指定 Grafana 部署在哪台机器上

 

alertmanager_servers:Alertemanager 实例的配置,用来指定 Alertmanager 部署在哪些机器上

4、资源限制

如果是多实例混部,或者和其他服务混部。可以限制组件的最大使用量。配置在local host

  - host: 172.16.188.123
resource_control:
memory_limit: 100G
cpu_quota: 1000%

5、各组件启动顺序

启动顺序

 

PD -> TiKV -> Pump -> TiDB -> TiFlash -> Drainer

 

升级顺序相同

 

关闭顺序相反

如果有TiCDC组件则启动顺序是这样的

 

PD -> TiKV -> Pump -> TiDB -> TiCDC

如果同时包含 TiCDC TiFlash -> Drainer 这3个组件,顺序是什么样的?

二、系统变量修改

这块比较简单,和MySQL语法兼容。

 

修改完之后对新的session生效,不需要滚动重启组件。

1、查看变量

SHOW VARIABLES LIKE ‘’;

2、修改变量

SET GLOBAL param=value;

修改完之后会固化到 TiKV 的表中INFORMATION_SCHEMA.SESSION_VARIABLES。不用担心重启后丢失修改。妈妈在也不用担心我的学习了。

三、配置文件模板

user: tidb
tidb_version: v4.0.15
last_ops_ver: |-
v1.2.3 tiup
Go Version: go1.13
Git Branch: release-1.2
GitHash: df7e28a
topology:
global:
user: tidb
ssh_port: 22
ssh_type: builtin
deploy_dir: /data/tdb
data_dir: /data/tdb/data
os: linux
arch: amd64
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
deploy_dir: /data/tdb/monitor-9100
data_dir: /data/tdb/data/monitor-9100
log_dir: /data/tdb/monitor-9100/log
server_configs:
tidb:
alter-primary-key: true
binlog.enable: true
binlog.ignore-error: false
binlog.write-timeout: 15s
compatible-kill-query: false
enable-streaming: true
host: 0.0.0.0
lease: 45s
log.enable-timestamp: true
log.expensive-threshold: 10000
log.file.max-days: 8
log.format: text
log.level: info
log.query-log-max-len: 4096
log.slow-threshold: 500
lower-case-table-names: 2
oom-action: log
performance.committer-concurrency: 256
performance.stmt-count-limit: 500000
performance.tcp-keep-alive: true
performance.txn-total-size-limit: 104857600
prepared-plan-cache.enabled: true
proxy-protocol.networks: 172.16.188.123
run-ddl: true
split-table: true
store: tikv
tikv-client.grpc-connection-count: 32
tikv-client.max-batch-size: 256
token-limit: 1500
tikv:
coprocessor.region-max-size: 384MB
coprocessor.region-split-size: 256MB
gRPC.grpc-concurrency: 8
log-level: info
raftdb.max-background-jobs: 8
raftstore.apply-max-batch-size: 16384
raftstore.apply-pool-size: 8
raftstore.hibernate-regions: true
raftstore.raft-max-inflight-msgs: 20480
raftstore.raft-max-size-per-msg: 2MB
raftstore.region-split-check-diff: 32MB
raftstore.store-max-batch-size: 16384
raftstore.store-pool-size: 8
raftstore.sync-log: false
readpool.coprocessor.max-tasks-per-worker-normal: 8000
readpool.unified.max-thread-count: 32
rocksdb.bytes-per-sync: 512MB
rocksdb.compaction-readahead-size: 2MB
rocksdb.defaultcf.level0-slowdown-writes-trigger: 32
rocksdb.defaultcf.level0-stop-writes-trigger: 64
rocksdb.defaultcf.max-write-buffer-number: 24
rocksdb.defaultcf.write-buffer-size: 256MB
rocksdb.lockcf.level0-slowdown-writes-trigger: 32
rocksdb.lockcf.level0-stop-writes-trigger: 64
rocksdb.max-background-flushes: 4
rocksdb.max-background-jobs: 8
rocksdb.max-sub-compactions: 4
rocksdb.use-direct-io-for-flush-and-compaction: true
rocksdb.wal-bytes-per-sync: 256MB
rocksdb.writecf.level0-slowdown-writes-trigger: 32
rocksdb.writecf.level0-stop-writes-trigger: 64
rocksdb.writecf.max-write-buffer-number: 24
rocksdb.writecf.write-buffer-size: 256MB
storage.block-cache.capacity: 8GB
storage.scheduler-concurrency: 4096000
storage.scheduler-worker-pool-size: 8
pd:
auto-compaction-mod: periodic
auto-compaction-retention: 10m
quota-backend-bytes: 17179869184
tiflash: {}
tiflash-learner: {}
pump: {}
drainer: {}
cdc: {}
tidb_servers:
- host: 172.16.188.123
ssh_port: 22
port: 4000
status_port: 10080
deploy_dir: /data/tdb/tidb-4000
arch: amd64
os: linux
- host: 172.16.188.143
ssh_port: 22
port: 4000
status_port: 10080
deploy_dir: /data/tdb/tidb-4000
arch: amd64
os: linux
tikv_servers:
- host: 172.16.188.140
ssh_port: 22
port: 20160
status_port: 20180
deploy_dir: /data/tdb/tikv-20160
data_dir: /data/tdb/data/tikv-20160
arch: amd64
os: linux
- host: 172.16.188.143
ssh_port: 22
port: 20160
status_port: 20180
deploy_dir: /data/tdb/tikv-20160
data_dir: /data/tdb/data/tikv-20160
arch: amd64
os: linux
- host: 172.16.188.113
ssh_port: 22
port: 20160
status_port: 20180
deploy_dir: /data/tdb/tikv-20160
data_dir: /data/tdb/data/tikv-20160
arch: amd64
os: linux
tiflash_servers: []
pd_servers:
- host: 172.16.188.120
ssh_port: 22
name: pd-172.16.188.120-2379
client_port: 2379
peer_port: 2380
deploy_dir: /data/tdb/pd-2379
data_dir: /data/tdb/data/pd-2379
arch: amd64
os: linux
- host: 172.16.188.118
ssh_port: 22
name: pd-172.16.188.118-2379
client_port: 2379
peer_port: 2380
deploy_dir: /data/tdb/pd-2379
data_dir: /data/tdb/data/pd-2379
arch: amd64
os: linux
- host: 172.16.188.125
ssh_port: 22
name: pd-172.16.188.125-2379
client_port: 2379
peer_port: 2380
deploy_dir: /data/tdb/pd-2379
data_dir: /data/tdb/data/pd-2379
arch: amd64
os: linux
pump_servers:
- host: 172.16.188.143
ssh_port: 22
port: 8250
deploy_dir: /data/pump
data_dir: /data/pump/data
log_dir: /data/pump/log
config:
gc: 5
arch: amd64
os: linux
cdc_servers:
- host: 172.16.188.120
ssh_port: 22
port: 8300
deploy_dir: /data/tdb/cdc-8300
arch: amd64
os: linux
monitoring_servers:
- host: 172.16.188.113
ssh_port: 22
port: 9090
deploy_dir: /data/tdb/prometheus-9090
data_dir: /data/tdb/data/prometheus-9090
arch: amd64
os: linux
grafana_servers:
- host: 172.16.188.123
ssh_port: 22
port: 3000
deploy_dir: /data/tdb/grafana-3000
arch: amd64
os: linux
alertmanager_servers:
- host: 172.16.188.123
ssh_port: 22
web_port: 9093
cluster_port: 9094
deploy_dir: /data/tdb/alertmanager-9093
data_dir: /data/tdb/data/alertmanager-9093
arch: amd64
os: linux

参考资料

https://github.com/pingcap/docs-cn/tree/master/config-templates

 

https://docs.pingcap.com/zh/tidb/stable/tiup-cluster-topology-reference

[转帖]TiDB 配置参数修改与系统变量修改步骤的更多相关文章

  1. windows下修改了系统变量里java_home所引用的jdk,但是查询jdk的版本并没有发生改变

    # 原因:因为%SystemRoot%\system32 在引用这个环境变量时,会默认C:\Windows\System32下的jdk版本 # 解决方法: 把jdk的配置放在path前面就可以了

  2. mysql 5.6 rpm安装启动、配置参数、字符集修改等

    linux 7 安装mysql server 注意:此mysql版本是el6 MySQL-server-5.6.35-1.el6.x86_64 一.安装部署: 1.yum:首先要配置yum源,yum安 ...

  3. 通过程序修改注册表键值来达到修改IE配置参数的目的

    通过程序修改注册表键值来达到修改IE配置参数的目的 使用IE访问应用程序或网页时经常需要设置一些选项(工具-Internet 选项),比如为了避免缓存网页,把工具-Internet选项-常规选项卡-I ...

  4. CAD系统变量(参数)大全

    所谓系统变量就是一些参数,这些参数有些是可以在“选项”或其他对话框中进行设置的,有些这必须通过在命令行输入变量名进行设置,当然对于高手来说,还可以通过二次开发程序来进行控制. CAD有很多的变量,例如 ...

  5. Crystal框架配置参数加载机制详解?

    前言 定义 配置参数定义的形式 配置参数文件定义在哪里? 配置参数加载的优先级 如何使用配置参数? 最佳实践 Jar项目中如何定义配置参数? War项目中如何定义或重载Jar包中的配置参数? 开发人员 ...

  6. MySQL的启动选项和系统变量该如何配置?

    MySQL的配置信息可以通过两种方式实现,一种是命令行形式,在启动MySQL服务时后边带上相关配置参数,此种方式会在MySQL重启后失效.另外一种是通过写入配置文件,如my.cnf,启动或者重启MyS ...

  7. 【Mysql】了解Mysql中的启动参数和系统变量

    一.启动参数 在程序启动时指定的设置项也称之为启动选项(startup options),这些选项控制着程序启动后的行为. 1)在命令行上使用选项 启动服务器程序的命令行后边指定启动选项的通用格式就是 ...

  8. PostgreSQL 配置参数

    一.配置参数所在文件.类型与查看方式 1.配置参数所在文件 postgresql.conf 2.配置参数类型 1)internal只读参数 这些参数不配置在postgresql.conf中,他们由po ...

  9. 帮助小白,最新版JDK的安装与环境变量配置(Win 10系统)

    学习JAVA,必须首先安装一下JDK(java development kit java开发工具包),之后再配置环境变量就可以开始使用JAVA了. 一,安装JDK 1,可以选择到官网下载最新版本的JD ...

  10. 深入理解mysql-进阶知识点,启动项、系统变量、字符集介绍!

    mysql数据库是当前应用最为的广泛的数据库,在实际工作中也经常接触到.真正用好mysql也不仅仅是会写sql就行,更重要的是真正理解其内部的工作原理.本文先从宏观角度介绍一些mysql相关的知识点, ...

随机推荐

  1. window10 AppX Deployment Service (AppXSVC)占用大量内存导致资源管理器卡死无响应

    window10 AppX Deployment Service (AppXSVC)占用大量内存导致资源管理器卡死无响应,导致无法进入桌面打开软件等等. 1.打开任务管理的情况下,先结束卡死的资源管理 ...

  2. CVE-2023-36025 Windows SmartScreen 安全功能绕过漏洞

    CVE-2023-36025是微软于11月补丁日发布的安全更新中修复Windows SmartScreen安全功能绕过漏洞.攻击者可以通过诱导用户单击特制的URL来利用该漏洞,对目标系统进行攻击.成功 ...

  3. 轻量化动态编译库 Natasha v8.0 正式发布!

    .NET8.0 与 动态编译 Hello 各位小伙伴,我于 2024年1月10日 发布了 Natasha 一个全新的里程碑版本 v8.0,对于老用户而言,此次发布版本号跨度较大,是因为我决定使用新的版 ...

  4. gmap构建离线地图,用createCustomerTiledLayer方法,瓦片地址尾部多了 ?x={x}&y={y}&z&{z} 导致无法显示地图。

    gmap构建离线地图,用createCustomerTiledLayer方法,瓦片地址尾部多了 ?x={x}&y={y}&z&{z} 导致无法显示地图. function in ...

  5. 云小课|云小课带您快速了解LTS可视化查看

    阅识风云是华为云信息大咖,擅长将复杂信息多元化呈现,其出品的一张图(云图说).深入浅出的博文(云小课)或短视频(云视厅)总有一款能让您快速上手华为云.更多精彩内容请单击此处. 摘要: 可视化查看是日志 ...

  6. 云图说丨OLAP开源引擎的一匹黑马,MRS集群组件之ClickHouse

    摘要:ClickHouse是俄罗斯公司 Yandex 在2016年开源的高性能.开源联机分析列式数据库管理系统.开源后,凭借卓越的分析性能.极好的线性扩展能力和丰富的功能,被业界公认为实时分析领域 O ...

  7. Jenkins Pipeline 流水线 - withCredentials 使用

    添加凭证 Pipeline script pipeline { agent any stages { stage('withCredentials 使用凭证') { steps { withCrede ...

  8. IDEA中无法import自己工程中类的问题解决方法

    今天开个很久没搞的工程,刚开的时候一片红,很自然的想到,要去配置一下项目的JDK,但是配置好之后,又出了个诡异问题:项目可以运行,但是import项目内部自己写的类的时候,都出现了红色错误.虽然imp ...

  9. L3-013 非常弹的球 (30 分) (math)

    刚上高一的森森为了学好物理,买了一个"非常弹"的球.虽然说是非常弹的球,其实也就是一般的弹力球而已.森森玩了一会儿弹力球后突然想到,假如他在地上用力弹球,球最远能弹到多远去呢?他不 ...

  10. 2022 开源之夏 | Serverless Devs 陪你“变得更强”

    Serverless 是近年来云计算领域热门话题,凭借极致弹性.按量付费.降本提效等众多优势受到很多人的追捧,各云厂商也在不断地布局 Serverless 领域.但是随着时间的发展,Serverles ...