配置文件topo.yaml
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/tidb-deploy"
data_dir: "/tidb-data"
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
server_configs:
tidb:
log.slow-threshold: 300
tikv:
readpool.storage.use-unified-pool: false
readpool.coprocessor.use-unified-pool: true
pd:
replication.enable-placement-rules: true
replication.location-labels: ["host"]
tiflash:
logger.level: "info"
pd_servers:
- host: 192.168.205.129
tidb_servers:
- host: 192.168.205.129
tikv_servers:
- host: 192.168.205.129
port: 20160
status_port: 20180
config:
server.labels: { host: "logic-host-1" }
- host: 192.168.205.129
port: 20161
status_port: 20181
config:
server.labels: { host: "logic-host-2" }
- host: 192.168.205.129
port: 20162
status_port: 20182
config:
server.labels: { host: "logic-host-3" }
tiflash_servers:
- host: 192.168.205.129
monitoring_servers:
- host: 192.168.205.129
grafana_servers:
- host: 192.168.205.129
tiup cluster start <cluster-name>
tiup cluster stop <cluster-name>
tiup cluster start <cluster-name>
通过 http://{grafana-ip}:3000 访问集群 Grafana 监控页面,默认用户名和密码均为 admin。
通过 http://{pd-ip}:2379/dashboard 访问集群 TiDB Dashboard 监控页面,默认用户名为 root,密码为空。
tiup cluster list
tiup cluster display <cluster-name>
下载:
wget https://download.pingcap.org/tidb-toolkit-v5.2.1-linux-amd64.tar.gz
解压:
tar xvf 对应的下载文件名
#创建文件夹
mkdir -p ./tmp/world
#授权文件权限
chmod 777 ./tmp/world
# 在工具包下面的 bin文件夹执行
./dumpling -u root -P 4000 -h 192.168.205.129 --filetype sql -t 8 -o ./tmp/world -r 200000 -F 256MiB -B world
cd tidb-toolkit-v5.0.1-linux-amd64/bin/
vi tidb-lightning.toml
内容为:
[lightning]
# 日志
level = "info"
file = "tidb-lightning.log"
[tikv-importer]
# 选择使用的 local 后端
backend = "local"
# 设置排序的键值对的临时存放地址,目标路径需要是一个空目录
sorted-kv-dir = "/tmp"
[mydumper] # 源数据目录。
data-source-dir = "/tmp/world/"
[tidb]
# 目标集群的信息
host = "172.16.6.212"
port = 4000
user = "root"
# 表架构信息在从 TiDB 的“状态端口”获取。
status-port = 10080
# 集群 pd 的地址
pd-addr = "172.16.6.202:2379"
整理好的
[lightning]
level = "info"
file = "tidb-lightning.log"
[tikv-importer]
backend = "local"
sorted-kv-dir = "/tmp/temp"
[mydumper]
data-source-dir = "/tmp/world/"
[tidb]
host = "192.168.205.129"
port = 4000
user = "root"
status-port = 10080
pd-addr = "192.168.205.129:2379"
./tidb-lightning -config tidb-lightning.toml
