使用Ansible部署集群,升级到Tiup后扩容集群,提示目录冲突,如何解决呢?

扩容tikv节点,之前使用ansible部署集群的时候,tidb和pd复用了同一台服务器,deploy_dir都是/data/deploy,现在升级到tiup,扩容的时候就会提示拓扑结构中的目录有冲突,无法使用 scale-out命令扩容

具体错误如下:
Starting component cluster: /root/.tiup/components/cluster/v1.2.0/tiup-cluster edit-config tidb-cluster
New topology could not be saved: Failed to parse topology file: directory conflict for ‘/data/deploy’ between ‘tidb_servers:10.36.1.36.deploy_dir’ and ‘pd_servers:10.36.1.36.deploy_dir’

请问你是扩容 pd 节点还是 tikv 节点报目录冲突?看报错信息是你 edit-config 配置文件时写错路径了。

扩容tikv节点,之前使用ansible部署集群的时候,tidb和pd复用了同一台服务器,deploy_dir都是/data/deploy,现在升级到tiup,扩容的时候就会提示拓扑结构中的目录有冲突,无法使用 scale-out命令扩容

原先在 depoly_dir 目录下 pd 和 tidb 正常还有一层子目录的,你可以通过下面方式调整下:
1.停止下集群
2.tiup cluster edit-config 修改 pd 和 tidb 的 deploy_dir 一直写到子目录,比如:


3.重新加载下集群:tiup cluster reload {cluster-name} --force
4.重启下集群

我之前部署的没有子目录,配置和执行文件以及日志都混在一起了,现在看没有好办法剥离开了

可以考虑先将这台 tidb server 节点缩容掉,让当前 depoly_dir 成为 pd 专用的路径,后面再将 tidb-server 扩容上,扩容时指定另外的 deploy_dir 路径。

考虑过了,缩容会删除目录,现在目录都是共用的,会导致别的模块数据丢失

1.方便把你当前的集群的拓扑文件发下吗?可以使用 tiup cluster edit-config {cluster-name}
2.扩容的配置文件也发出来看下,谢谢。

当前拓扑
global:
user: tidb
ssh_port: 22
ssh_type: builtin
deploy_dir: /data/deploy
data_dir: data
os: linux
arch: amd64
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
deploy_dir: /data/deploy
data_dir: /data/deploy/data
log_dir: /data/deploy/log
tidb_servers:

  • host: 10.36.1.36
    ssh_port: 22
    port: 4000
    status_port: 10080
    deploy_dir: /data/deploy
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
  • host: 10.36.2.72
    ssh_port: 22
    port: 4000
    status_port: 10080
    deploy_dir: /data/deploy
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
    tikv_servers:
  • host: 10.36.1.32
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /data/deploy
    data_dir: /data/deploy/data
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
  • host: 10.36.2.70
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /data/deploy
    data_dir: /data/deploy/data
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
  • host: 10.36.1.31
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /data/deploy
    data_dir: /data/deploy/data
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
    tiflash_servers: []
    pd_servers:
  • host: 10.36.1.36
    ssh_port: 22
    name: pd_tidb001
    client_port: 2379
    peer_port: 2380
    deploy_dir: /data/deploy
    data_dir: /data/deploy/data.pd
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
  • host: 10.36.2.72
    ssh_port: 22
    name: pd_tidb002
    client_port: 2379
    peer_port: 2380
    deploy_dir: /data/deploy
    data_dir: /data/deploy/data.pd
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
  • host: 10.36.1.37
    ssh_port: 22
    name: pd_tidb003
    client_port: 2379
    peer_port: 2380
    deploy_dir: /data/deploy
    data_dir: /data/deploy/data.pd
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
    monitoring_servers:
  • host: 10.36.1.36
    ssh_port: 22
    port: 9090
    deploy_dir: /data/deploy
    data_dir: /data/deploy/prometheus2.0.0.data.metrics
    log_dir: /data/deploy/log
    storage_retention: 30d
    arch: amd64
    os: linux
    grafana_servers:
  • host: 10.36.1.36
    ssh_port: 22
    port: 3000
    deploy_dir: /data/deploy
    arch: amd64
    os: linux

扩容拓扑
tikv_servers:

  • host: 10.36.2.33
    ssh_port: 22
    imported: true
    port: 20160
    status_port: 20180
    deploy_dir: /data/deploy
    data_dir: /data/deploy/data
    log_dir: /data/deploy/log
    arch: amd64
    os: linux
  1. 从 TiDB Ansible 导入进来的集群,通过 tiup cluster edit-config 的时候,不要将 imported:true 配置去掉,该配置为标识是否是从 TiDB Ansible 导入的集群,如果去掉可能会导致 tiup 管理集群出错,我看你集群配置文件中已经没有该配置项了,麻烦先还原回去;
  2. scale-out 扩容时,将scale-out 文件中imported:true去掉再试下。

请问下升级后你是通过什么方式 imported:true 从配置文件中去掉的?

哈喽,这个问题解决了么?我也遇到了。。。