TiFlash在线扩缩容
作者:互联网
Tiflash扩缩容方式和TiDB/TiKV/PD不一样;
首先确认版本,TiFlash在线扩容,必须是V4.0以上版本;
如果是v4.0需要开启PD参数 enable-placement-rules ; 如果是v5.0,该菜蔬默认开启;
一、 编辑配置文件
tiflash_servers:
- host: x.x.x.x
ssh_port: 22
tcp_port: 9000
http_port: 8123
flash_service_port: 3930
flash_proxy_port: 20170
flash_proxy_status_port: 20292
metrics_port: 8234
deploy_dir: /export/servers/TiDB/soft/tiflash-9000
data_dir: /export/servers/TiDB/data/tiflash-9000
log_dir: /export/servers/TiDB/soft/tiflash-9000/log
二,开始扩容:
tiup cluster scale-out cluster-default scale-out-tiflash.yaml
扩容完毕提示: Scaled cluster `cluster-default` out successfully
三、 tiup cluster display cluster-default 验证
在线缩容
一, 需要保证tiflash缩容后的剩余节点数大于表的最大副本数,否则就需要调整副本数;调整命令如下: alter table {dbname}.{tbname} set tiflash replica 0
查看Tiflash表副本数方式:
mysql> select * from information_schema.tiflash_replica;
+--------------+------------+----------+---------------+-----------------+-----------+----------+
| TABLE_SCHEMA | TABLE_NAME | TABLE_ID | REPLICA_COUNT | LOCATION_LABELS | AVAILABLE | PROGRESS |
+--------------+------------+----------+---------------+-----------------+-----------+----------+
| test | hero | 57 | 2 | | 1 | 1 |
| test | t1 | 59 | 2 | | 1 | 1 |
| test | t2 | 63 | 2 | | 1 | 1 |
+--------------+------------+----------+---------------+-----------------+-----------+----------+
3 rows in set (0.00 sec)
二、 查看要缩容的节点信息
tiup cluster display cluster-default
三、 执行缩容
tiup cluster scale-in cluster-default x.x.x.x:9000
成功后提示: Scaled cluster `cluster-default` in successfully
四,销毁节点
缩容后节点状态变为Tombstone,如下:
# tiup cluster display cluster-default
Starting component `cluster`: /root/.tiup/components/cluster/v1.7.0/tiup-cluster display cluster-default
Cluster type: tidb
Cluster name: cluster-default
Cluster version: v5.3.0
Deploy user: tidb
SSH type: builtin
Dashboard URL: http://x.x.x.x:2379/dashboard
ID Role Host Ports OS/Arch Status Data Dir Deploy Dir
-- ---- ---- ----- ------- ------ -------- ----------
x.x.x.x:9093 alertmanager x.x.x.x 9093/9094 linux/x86_64 Up /export/servers/TiDB/data/alertmanager-9093 /export/servers/TiDB/soft/alertmanager-9093
x.x.x.x:3000 grafana x.x.x.x 3000 linux/x86_64 Up - /export/servers/TiDB/soft/grafana-3000
x.x.x.x:2379 pd x.x.x.x 2379/2380 linux/x86_64 Up|UI /export/servers/TiDB/data/pd-2379 /export/servers/TiDB/soft/pd-2379
x.x.x.x:2379 pd x.x.x.x 2379/2380 linux/x86_64 Up /export/servers/TiDB/data/pd-2379 /export/servers/TiDB/soft/pd-2379
x.x.x.x:2379 pd x.x.x.x 2379/2380 linux/x86_64 Up|L /export/servers/TiDB/data/pd-2379 /export/servers/TiDB/soft/pd-2379
x.x.x.x:9090 prometheus x.x.x.x 9090 linux/x86_64 Up /export/servers/TiDB/data/prometheus-9090 /export/servers/TiDB/soft/prometheus-9090
x.x.x.x:4000 tidb x.x.x.x 4000/10080 linux/x86_64 Up - /export/servers/TiDB/soft/tidb-4000
x.x.x.x:9000 tiflash x.x.x.x 9000/8123/3930/20170/20292/8234 linux/x86_64 Tombstone /export/servers/TiDB/data/tiflash-9000 /export/servers/TiDB/soft/tiflash-9000
x.x.x.x:9000 tiflash x.x.x.x 9000/8123/3930/20170/20292/8234 linux/x86_64 Up /export/servers/TiDB/data/tiflash-9000 /export/servers/TiDB/soft/tiflash-9000
x.x.x.x:20160 tikv x.x.x.x 20160/20180 linux/x86_64 Up /export/servers/TiDB/data/tikv-20160 /export/servers/TiDB/soft/tikv-20160
x.x.x.x:20160 tikv x.x.x.x 20160/20180 linux/x86_64 Up /export/servers/TiDB/data/tikv-20160 /export/servers/TiDB/soft/tikv-20160
x.x.x.x:20160 tikv x.x.x.x 20160/20180 linux/x86_64 Up /export/servers/TiDB/data/tikv-20160 /export/servers/TiDB/soft/tikv-20160
Total nodes: 12
There are some nodes can be pruned:
Nodes: [x.x.x.x:3930]
You can destroy them with the command: `tiup cluster prune cluster-default`
tiup cluster prune {cluster-name} --force进行销毁
成功销毁后提示: Destroy success
标签:TiFlash,在线,扩缩容,tiflash,servers,cluster,export,TiDB,soft 来源: https://blog.csdn.net/JSWANGCHANG/article/details/122500313