ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

TiFlash在线扩缩容

2022-01-14 20:34:10  阅读:301  来源: 互联网

标签:TiFlash 在线 扩缩容 tiflash servers cluster export TiDB soft


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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有