[转帖]TiDB 配置参数修改与系统变量修改步骤
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 配置参数修改与系统变量修改步骤的更多相关文章
- windows下修改了系统变量里java_home所引用的jdk,但是查询jdk的版本并没有发生改变
# 原因:因为%SystemRoot%\system32 在引用这个环境变量时,会默认C:\Windows\System32下的jdk版本 # 解决方法: 把jdk的配置放在path前面就可以了
- mysql 5.6 rpm安装启动、配置参数、字符集修改等
linux 7 安装mysql server 注意:此mysql版本是el6 MySQL-server-5.6.35-1.el6.x86_64 一.安装部署: 1.yum:首先要配置yum源,yum安 ...
- 通过程序修改注册表键值来达到修改IE配置参数的目的
通过程序修改注册表键值来达到修改IE配置参数的目的 使用IE访问应用程序或网页时经常需要设置一些选项(工具-Internet 选项),比如为了避免缓存网页,把工具-Internet选项-常规选项卡-I ...
- CAD系统变量(参数)大全
所谓系统变量就是一些参数,这些参数有些是可以在“选项”或其他对话框中进行设置的,有些这必须通过在命令行输入变量名进行设置,当然对于高手来说,还可以通过二次开发程序来进行控制. CAD有很多的变量,例如 ...
- Crystal框架配置参数加载机制详解?
前言 定义 配置参数定义的形式 配置参数文件定义在哪里? 配置参数加载的优先级 如何使用配置参数? 最佳实践 Jar项目中如何定义配置参数? War项目中如何定义或重载Jar包中的配置参数? 开发人员 ...
- MySQL的启动选项和系统变量该如何配置?
MySQL的配置信息可以通过两种方式实现,一种是命令行形式,在启动MySQL服务时后边带上相关配置参数,此种方式会在MySQL重启后失效.另外一种是通过写入配置文件,如my.cnf,启动或者重启MyS ...
- 【Mysql】了解Mysql中的启动参数和系统变量
一.启动参数 在程序启动时指定的设置项也称之为启动选项(startup options),这些选项控制着程序启动后的行为. 1)在命令行上使用选项 启动服务器程序的命令行后边指定启动选项的通用格式就是 ...
- PostgreSQL 配置参数
一.配置参数所在文件.类型与查看方式 1.配置参数所在文件 postgresql.conf 2.配置参数类型 1)internal只读参数 这些参数不配置在postgresql.conf中,他们由po ...
- 帮助小白,最新版JDK的安装与环境变量配置(Win 10系统)
学习JAVA,必须首先安装一下JDK(java development kit java开发工具包),之后再配置环境变量就可以开始使用JAVA了. 一,安装JDK 1,可以选择到官网下载最新版本的JD ...
- 深入理解mysql-进阶知识点,启动项、系统变量、字符集介绍!
mysql数据库是当前应用最为的广泛的数据库,在实际工作中也经常接触到.真正用好mysql也不仅仅是会写sql就行,更重要的是真正理解其内部的工作原理.本文先从宏观角度介绍一些mysql相关的知识点, ...
随机推荐
- SpringBoot结合ajax实现登录功能
1:ajax是什么(https://www.w3school.com.cn/ajax/ajax_intro.asp)? AJAX 是一种在无需重新加载整个网页的情况下,能够更新部分网页的技术. AJA ...
- electron入门之配置镜像加速(四)
electron入门到入土,配置阿里镜像加速.为了防止后面我们打包龟速,需要给electron配置阿里镜像加速 在下面的文件内添加阿里镜像加速,你的文件位置不一定是这个 C:\Program File ...
- [Acwing 164. 可达性统计] 题解报告
事实上,这道题并不需要拓扑排序.(当然,拓扑排序还是更快) 题目分析 首先,题目中说了,这是一个有向无环图,所以,我们可以考虑 \(\texttt{DP}\) / 记搜 / 拓扑排序 来解决这道题. ...
- 通用 Mapper 的批量插入实现
具体的 SQL 模板实现如下所示: import org.apache.ibatis.mapping.MappedStatement; import tk.mybatis.mapper.MapperE ...
- CSS3学习笔记-过渡
学习CSS3过渡(Transitions)是为了在元素状态之间创建平滑的动画效果.下面是一些关于CSS3过渡的学习笔记: 过渡基础语法: 使用transition属性来定义过渡效果. 通过指定过渡的属 ...
- ElasticSearch-2
原文链接:https://gaoyubo.cn/blogs/cbe60a4d.html 一.DSL查询文档 1.1DSL查询分类 Elasticsearch提供了基于JSON的DSL(Domain S ...
- 云小课|GaussDB如何进行性能调优
阅识风云是华为云信息大咖,擅长将复杂信息多元化呈现,其出品的一张图(云图说).深入浅出的博文(云小课)或短视频(云视厅)总有一款能让您快速上手华为云.更多精彩内容请单击此处. 摘要:GaussDB性能 ...
- 整理混乱的头文件,我用include what you use
摘要:使用include-what-you-use(iwyu/IWYU)清理冗余头文件,补充必要头文件. 本文分享自华为云社区<用include what you use拯救混乱的头文件> ...
- 如何对APP进行安全加固
如何对APP进行安全加固 引言 如今,移动应用市场蓬勃发展,APP数量呈现爆炸性增长.随着5G技术的广泛应用,APP的增长趋势持续增强.然而,由于APP的泛滥,网络攻击者的目标也在逐渐转移,数亿的 ...
- 开心档之CSS 测验
目录 CSS 测验 编辑 CSS 测验 CSS测验是一种衡量前端开发人员对CSS的熟练程度的测试.通过CSS测验,可以评估一个人对CSS语言的掌握程度和应用能力,帮助公司或招聘方挑选合适的人才. ...