TiDB-OPS

TiDB-ansible 问题收集处理

自定义信息修改

默认端口

默认目录信息及变量

Local

supervise

Tikv

PD

PUMP

TiDB

monitoring

服务部署场景

单机多 TIKV 场景

物理机场景,多块磁盘,双路 CPU, 大于 128G 内存,千兆以上内网

  1. 单机部署多 tikv,并设置 labels
    • labels 只有在第一次部署时生效,后续添加不生效。
  2. tikv.toml 需要设置 block-cache-size,防止 tikv OOM
    • 假设机器配置 128G / 48U ,sql 常见为简单事务,多写 配置如下
      • block-cache-size
        • default 2G
        • write 4G
        • raft 1G
        • lock 1G
  [tikv_servers]
  tikv-3-1 ansible_host=10.1.3.1 deploy_dir=/data1/deploy tikv_port=20171 labels="host=h1"
  tikv-3-2 ansible_host=10.1.3.2 deploy_dir=/data2/deploy tikv_port=20172 labels="host=h1"
  tikv-4-1 ansible_host=10.1.4.1 deploy_dir=/data1/deploy tikv_port=20171 labels="host=h2"
  tikv-4-2 ansible_host=10.1.4.2 deploy_dir=/data2/deploy tikv_port=20172 labels="host=h2"

  [pd_servers:vars]
  max-replicas = 3
  #location-labels = ["zone", "rack", "host"]
  location_labels = ["host"]

labels

配合多单机多 tikv 节点设置 后期可以通过 api 可以修改

  1. labels 分层级读取与写入,假设层级为 ["zone", "rack", "host"]
  2. 逐级检测,数据不会存放在同性 (labels) 之内。当只有一种的时候,数据会存放随机存放
  3. 传送门

inventory.ini 特性开关

ansible 错误说明

执行 bootstarp.yml

执行 deploy.yml

执行 start.yml

执行 stop.yml

执行 rolling_update.yml

组件

PD

TIKV

Grafana

dests.json 文件内容

[
    {
        "name": "Test-Cluster",
        "url": "http://172.16.10.65:3000/",
        "titles": {
            "node": "Test-Cluster-Node-Export",
            "disk_performance": "Test-Cluster-Disk Performance",
            "overview": "Test-Cluster-Overview",
            "tikv": "Test-Cluster-TiKV",
            "pd": "Test-Cluster-PD",
            "tidb": "Test-Cluster-TiDB"
        },
        "user": "admin",
        "password": "admin",
        "datasource": "test-cluster"
    }
]

生成 dests.json 文件步骤在 tidb-ansible/start.yml 290 行

FAQ

ansible remote host No response

for me, this resolved on Ubuntu 16.04 with this added to ansible.cfg:

[ssh_connection] 
# for running on Ubuntu
control_path=%(directory)s/%%h-%%r
On related note, this resolved it when running on Mac host:

[ssh_connection] 
# for running on OSX
control_path = %(directory)s/%%C
Solved the issue by installing sshpass using command:

sudo apt-get install sshpass