当前机器上存在混合部署多套TiDB,所有会出现多个不同端口得进程
1.tidb-server
根据进程过滤,可以看到 tidb-server 启动时使用的参数以及配置文件tidb.toml
[tidb@ip-172-16-30-86 tidb-ansible]$ ps -ef|grep tidb-server
tidb 15642 10753 0 13:58 pts/2 00:00:00 grep --color=auto tidb-server
tidb_te+ 40226 40225 1 Feb26 ? 01:39:42 bin/tidb-server -P 6000 --status=10000 --advertise-address=172.16.30.86 --path=172.16.30.86:12379,172.16.30.87:12379,172.16.30.88:12379 --config=conf/tidb.toml --enable-binlog --log-file=/data2/tidb_cluster/log/tidb.log
tidb 185764 185763 1 Mar01 ? 01:14:08 bin/tidb-server -P 5000 --status=10086 --advertise-address=172.16.30.86 --path=172.16.30.86:2479,172.16.30.87:2479,172.16.30.88:2479 --config=conf/tidb.toml --enable-binlog --log-file=/data/tidb/deploy_tidb/tidb/log/tidb.log
tidb-server 具体参数
官方文档链接:https://pingcap.com/docs-cn/op-guide/configuration/
[tidb@ip-172-16-30-86 bin]$ pwd
/data/tidb/deploy_tidb/tidb/bin
[tidb@ip-172-16-30-86 bin]$ ./tidb-server --help
Usage of ./bin/tidb-server:
-L string
log level: info, debug, warn, error, fatal (default "info")
-P string
# tidb server port (default "4000") tidb-server 的端口,默认为 4000
-V print version information and exit (default false) # 统计版本
-advertise-address string
# tidb server advertise IP
-config string
# config file path,tidb 服务的配置文件,命令行的优先级高于配置文件
-enable-binlog
# enable generate binlog (default false),是否开启 binlog,默认为关闭,若开启,则 ps -ef 时,tidb-server 后面就会跟上该参数,即 -enable-binlog
-host string
# tidb server host (default "0.0.0.0")
-lease string
# Schema 的 lease 主要用在 online schema changes 上面。这个值会影响到实际的 DDL 语句的执行时间。大多数情况下,用户不需要修改这个值
-log-file string
# log file path 日志的路径
-log-slow-query string
# slow query file path 慢日志的路径
-metrics-addr string
# prometheus pushgateway address, leaves it empty will disable prometheus push.prometheus push gateway 的地址,如果为空则不推送
-metrics-interval uint
# prometheus client push interval in second, set "0" to disable prometheus push. (default 15) 推送统计信息到 prometheus push Gateway 的时间间隔
-path string
# tidb storage path (default "/tmp/tidb") tidb 存储引擎的路径
-proxy-protocol-header-timeout uint
# proxy protocol header read timeout, unit is second. (default 5)。PROXY Protocol 请求头读取超时时间。
-proxy-protocol-networks string
# PROXY Protocol 允许的代理服务器地址列表,如果需要配置多个地址用,分隔。
-report-status
# If enable status report HTTP service. (default true) 打开或者关闭服务状态监听端口
-run-ddl
# run ddl worker on this tidb-server (default true) tidb-server 本身是否运行 ddl
-socket string
# The socket file to use for connection. 提供连接的 socket 文件
-status string
# tidb server status port (default "10080") tidb server 的状态端口
-store string
# registered store name, [tikv, mocktikv] (default "mocktikv"),tidb 底层使用搞得存储引擎
-token-limit int
# the limit of concurrent executed sessions (default 1000) TiDB 中允许同时运行的 session 数量,用于控制并发
部署前未配置ansible目录下conf/tidb.yml,则ansible部署按默认配置生成tidb.toml并启动
[tidb@ip-172-16-30-86 conf]$ pwd
/data/tidb/deploy_tidb/tidb/conf
[tidb@ip-172-16-30-86 conf]$ cat tidb.toml
# TiDB Configuration.
compatible-kill-query = false
enable-streaming = false
host = "0.0.0.0"
lease = "45s"
lower-case-table-names = 2
oom-action = "log"
run-ddl = true
socket = ""
split-table = true
store = "tikv"
token-limit = 1000
[log]
disable-timestamp = false
expensive-threshold = 10000
format = "text"
level = "info"
query-log-max-len = 2048
slow-threshold = 300
[log.file]
log-rotate = true
max-backups = 0
max-days = 0
max-size = 300
[security]
cluster-ssl-ca = ""
cluster-ssl-cert = ""
cluster-ssl-key = ""
ssl-ca = ""
ssl-cert = ""
ssl-key = ""
[status]
report-status = true
[performance]
cross-join = true
feedback-probability = 0.05
force-priority = "NO_PRIORITY"
max-procs = 0
pseudo-estimate-ratio = 0.8
query-feedback-limit = 1024
run-auto-analyze = true
stats-lease = "3s"
stmt-count-limit = 5000
tcp-keep-alive = true
[proxy-protocol]
header-timeout = 5
networks = ""
[prepared-plan-cache]
capacity = 100
enabled = false
[opentracing]
enable = false
rpc-metrics = false
[opentracing.reporter]
buffer-flush-interval = 0
local-agent-host-port = ""
log-spans = false
queue-size = 0
[opentracing.sampler]
max-operations = 0
param = 1.0
sampling-refresh-interval = 0
sampling-server-url = ""
type = "const"
[tikv-client]
commit-timeout = "41s"
grpc-connection-count = 16
grpc-keepalive-time = 10
grpc-keepalive-timeout = 3
[txn-local-latches]
capacity = 10240000
enabled = false
[binlog]
ignore-error = false
write-timeout = "15s"
2.tikv-server
根据当前 tikv 启动进程状态,可以了解一些启动参数,注意:ps -ef|grep tikv-server 命令需要在安装tikv实例得机器上执行
[tidb@ip-172-16-30-88 ~]$ ps -ef|grep tikv-server
tidb 4636 4542 0 14:11 pts/0 00:00:00 grep --color=auto tikv-server
tidb 18281 18280 0 Feb19 ? 02:46:33 bin/tikv-server --addr 0.0.0.0:20191 --advertise-addr 172.16.30.88:20191 --pd 172.16.30.86:2479,172.16.30.87:2479,172.16.30.88:2479 --data-dir /data/tidb/deploy_tidb/tikv1/data --config conf/tikv.toml --log-file /data/tidb/deploy_tidb/tikv1/log/tikv.log
tidb 21767 21766 0 Feb19 ? 02:32:09 bin/tikv-server --addr 0.0.0.0:20192 --advertise-addr 172.16.30.88:20192 --pd 172.16.30.86:2479,172.16.30.87:2479,172.16.30.88:2479 --data-dir /data/tidb/deploy_tidb/tikv2/data --config conf/tikv.toml --log-file /data/tidb/deploy_tidb/tikv2/log/tikv.log
tidb_te+ 30026 30025 0 Feb20 ? 01:14:12 bin/tikv-server --addr 0.0.0.0:2000 --advertise-addr 172.16.30.88:2000 --pd 172.16.30.86:12379,172.16.30.87:12379,172.16.30.88:12379 --data-dir /data2/tidb_cluster/tikv3/data --config conf/tikv.toml --log-file /data2/tidb_cluster/tikv3/log/tikv.log
查看 tikv-server 的 help 的相关命令
g该机器上存在多tikv节点
[tidb@ip-172-16-30-88 deploy_tidb]$ ls
backup bin conf log pd pump1 scripts status tikv1 tikv2
[tidb@ip-172-16-30-88 deploy_tidb]$ cd tikv
-bash: cd: tikv: No such file or directory
[tidb@ip-172-16-30-88 deploy_tidb]$ cd tikv2/
[tidb@ip-172-16-30-88 tikv2]$ ls
backup bin conf data log scripts status
[tidb@ip-172-16-30-88 tikv2]$ bin/tikv-server --help
TiKV
PingCAP Inc. <info@pingcap.com>
A Distributed transactional key-value database powered by Rust and Raft
USAGE:
tikv-server [FLAGS] [OPTIONS]
FLAGS:
-h, --help
# Prints help information,查看帮助
--print-sample-config
# Print a sample config to stdout,将示例配置打印出来
-V, --version
# Prints version information ,版本
OPTIONS:
-A, --addr <IP:PORT>
# Sets listening address,设置监听地址以及端口
--advertise-addr <IP:PORT>
# Sets advertise listening address for client communication
--capacity <CAPACITY>
# Sets the store capacity. If not set, use entire partition,设置存储容量,如果没有设置,则使用整个分区
-C, --config <FILE>
# Sets config file,设置配置文件
-s, --data-dir <PATH>
# Sets the path to store directory,设置存储目录的路径
--labels <KEY=VALUE>...
# Sets server labels. Uses `,` to separate kv pairs, like `zone=cn,disk=ssd`,设置服务器标签
-f, --log-file <FILE>
# Sets log file. If not set, output log to stderr,设置日志文件
-L, --log-level <LEVEL>
# Sets log level [possible values: trace, debug, info, warn, warning, error, critical],设置日志级别标签
--pd-endpoints <PD_URL>...
# Sets PD endpoints. Uses `,` to separate multiple PDs,设置 pd 端点
部署前未配置ansible目录下conf/tikv.yml,则ansible部署按默认配置生成tikv.toml并启动
[tidb@ip-172-16-30-88 tikv2]$ cat conf/tikv.toml
# TiKV config template
# Human-readable big numbers:
# File size(based on byte): KB, MB, GB, TB, PB
# e.g.: 1_048_576 = "1MB"
# Time(based on ms): ms, s, m, h
# e.g.: 78_000 = "1.3m"
[readpool.storage]
[readpool.coprocessor]
high-concurrency = 4
low-concurrency = 4
normal-concurrency = 4
[server]
labels = { host = "ip-172-16-30-88" }
[storage]
[pd]
# This section will be overwritten by command line parameters
[metric]
address = "172.16.30.86:9099"
interval = "15s"
job = "tikv"
[raftstore]
raftdb-path = ""
sync-log = true
[coprocessor]
[rocksdb]
wal-dir = ""
[rocksdb.defaultcf]
block-cache-size = "5GB"
[rocksdb.lockcf]
block-cache-size = "256MB"
[rocksdb.writecf]
block-cache-size = "8000MB"
[raftdb]
[raftdb.defaultcf]
block-cache-size = "256MB"
[security]
ca-path = ""
cert-path = ""
key-path = ""
[import]
3. pd-server
根据当前 pd 启动进程状态,可以了解一些启动参数,注意:ps -ef|grep pd-server 命令需要在安装pd实例得机器上执行
[tidb@ip-172-16-30-88 tikv2]$ ps -ef|grep pd-server
tidb 16886 4542 0 14:21 pts/0 00:00:00 grep --color=auto pd-server
tidb_te+ 26551 26550 5 Feb20 ? 16:29:11 bin/pd-server --name=pd3 --client-urls=http://172.16.30.88:12379 --advertise-client-urls=http://172.16.30.88:12379 --peer-urls=http://172.16.30.88:12390 --advertise-peer-urls=http://172.16.30.88:12390 --data-dir=/data2/tidb_cluster/pd3/data.pd --initial-cluster=pd1=http://172.16.30.86:12390,pd2=http://172.16.30.87:12390,pd3=http://172.16.30.88:12390 --config=conf/pd.toml --log-file=/data2/tidb_cluster/pd3/log/pd.log
tidb 191377 191376 12 Mar01 ? 08:54:04 bin/pd-server --name=pd3 --client-urls=http://172.16.30.88:2479 --advertise-client-urls=http://172.16.30.88:2479 --peer-urls=http://172.16.30.88:2480 --advertise-peer-urls=http://172.16.30.88:2480 --data-dir=/data/tidb/deploy_tidb/pd/data.pd --initial-cluster=pd1=http://172.16.30.86:2480,pd2=http://172.16.30.87:2480,pd3=http://172.16.30.88:2480 --config=conf/pd.toml --log-file=/data/tidb/deploy_tidb/pd/log/pd.log
[tidb@ip-172-16-30-88 tikv2]$
查看 pd-server 的 help 的相关命令
[tidb@ip-172-16-30-88 tikv2]$ cd ..
[tidb@ip-172-16-30-88 deploy_tidb]$ cd pd/
[tidb@ip-172-16-30-88 pd]$ ls
backup bin conf data.pd log scripts status
[tidb@ip-172-16-30-88 pd]$ bin/pd-server --help
Usage of pd:
-L string
log level: debug, info, warn, error, fatal (default 'info') # pd server 输出日志格式
-V print version information and exit # pd server 版本
-advertise-client-urls string # pd server 本机客户端url 如:http://IP:2379,默认${client-urls}
advertise url for client traffic (default '${client-urls}')
-advertise-peer-urls string # pd server 其他节点客户端url 如:http://IP:2379,默认${peer-urls}
advertise url for peer traffic (default '${peer-urls}')
-cacert string # TLS 认证
Path of file that contains list of trusted TLS CAs
-cert string # PEM format
Path of file that contains X509 certificate in PEM format
-client-urls string # pd server 本机客户端url 如:http://IP:2379
url for client traffic (default "http://127.0.0.1:2379")
-config string # pd server 配置文件conf/pd.toml
Config file
-data-dir string # pd server 数据存放目录
path to the data directory (default 'default.${name}')
-initial-cluster string # 初始化 PD 集群配置。
initial cluster configuration for bootstrapping, e,g. pd=http://127.0.0.1:2380 默认: “{name}=http://{advertise-peer-url}”
例如,如果 name 是 “pd”, 并且 advertise-peer-urls 是 “http://192.168.100.113:2380", 那么 initial-cluster 就是 pd=http://192.168.100.113:2380
如果你需要启动三台 PD,那么 initial-cluster 可能就是 pd1=http://192.168.100.113:2380, pd2=http://192.168.100.114:2380, pd3=192.168.100.115:2380
-join string # 动态加入 PD 集群
默认: “”
如果你想动态将一台 PD 加入集群,你可以使用 --join="${advertise-client-urls}", advertise-client-url 是当前集群里面任意 PD 的 advertise-client-url,你也可以使用多个 PD 的,需要用逗号分隔
join to an existing cluster (usage: cluster's '${advertise-client-urls}'
-key string
Path of file that contains X509 key in PEM format
-log-file string # 日志文件路径
log file path
-log-rotate # 日志文件是否开启切割
rotate log (default true)
-name string # pd 名字
human-readable name for this pd member (default "pd")
-namespace-classifier string
namespace classifier (default 'table') (default "table")
-peer-urls string
url for peer traffic (default "http://127.0.0.1:2380")
-version
print version information and exit
部署前未配置ansible目录下conf/pd.yml,则ansible部署按默认配置生成pd.toml并启动
[tidb@ip-172-16-30-88 pd]$ cat conf/pd.toml
# PD Configuration
initial-cluster-state = "new"
enable-prevote = true
lease = 3
namespace-classifier = "table"
tso-save-interval = "3s"
[security]
cacert-path = ""
cert-path = ""
key-path = ""
[log]
level = "info"
[log.file]
[metric]
[schedule]
leader-schedule-limit = 4
max-merge-region-keys = 0
max-merge-region-size = 0
max-pending-peer-count = 16
max-snapshot-count = 3
max-store-down-time = "30m"
merge-schedule-limit = 8
region-schedule-limit = 4
replica-schedule-limit = 8
split-merge-interval = "1h"
tolerant-size-ratio = 5.0
[replication]
location-labels = ["host"]
max-replicas = 3
版权声明:本文为博主原创文章,未经博主允许不得转载。



