写点什么

TiDB 快速部署工具

  • 2023-11-10
    北京
  • 本文字数:16308 字

    阅读完需:约 54 分钟

作者: cchouqiang 原文来源:https://tidb.net/blog/f7278c98

背景

   TiDB集群安装部署很简便,依靠tiup命令,可以实现部署、扩容、缩容、修改参数等;但是集群部署所需要的deploy.yaml文件需要手工编写。对于大规模的集群来说,编写deploy.yaml文件耗费时间还是很多的,尤其是几十台甚至上百台机器,编写配置文件所需要的工作量会成倍增加。
基于大规模集群编写配置文件的痛点,若有快速生成集群配置文件的工具,会给部署集群带来很大的便利,让部署TiDB集群变得更easy。
由于部署集群前,负责硬件的同事会提供一个机器IP的基本信息表,利用该表格的信息,在添加一些部署集群所需的信息,自动生成deploy.yaml文件。我把我的想法跟马学涛(github:dxhmxt)老师沟通了一下,他觉得这个想法不错,就利用自己休息时间,写了一个快速部署工具[tidbdeploy-v1.0.4.tar](https://github.com/dxhmxt/TiDB-/blob/main/tidbdeploy-v1.0.4.tar "tidbdeploy-v1.0.4.tar")。
复制代码

部署工具介绍

   TiDB部署助手工具用于TiDB for OP离线部署,基于tiup和linux expect在部署节点(Tiup节点)执行文本菜单数字选项完成集群部署工作。TiDB部署助手工具对设置root用户和创建实例用户及其互信设置、初始化系统参数、挂载数据盘、编辑部署yaml文件、部署集群、设置数据库root密码、初始化数据库参数部署工作逻辑进行了封装。优化了重复执行命令、编辑yaml文件工作,可帮助大家提升部署效率,尤其是大规模、多套集群部署场景。
TiDB部署助手工具实现功能有:
复制代码


1)快速生成集群部署所需的配置文件;


2)根据集群拓扑规划文件,配置安装用户之间的互信、并进行互信结果检查;


3)读取集群部署初始配置文件和集群拓扑规划文件快速完成整个集群部署系统参数初始化;


4)读取集群拓扑规划文件对不同类型节点(tidb 节点和非 tidb 节点)进行数据盘初始化和挂载;


5)读取集群部署初始配置文件和集群集群拓扑规划文件,结合 linux expect 快速完成用户创建和互信设置及设置互信后结果检查;


6)读取集群拓扑规划文件,实现两个功能:a. 快速生成 host 和 role 对应 yaml 格式文件、遍历采集服务器 CPU 和 MEM 配置匹配集群拓扑规划文件生成动态参数值,最后生成部署 yaml 文件;b. 快速生成相同架构规划 yaml 文件;(尤其同一个系统部署多套相关配置和规划的环境);


7)读取集群部署初始配置文件和 yaml 文件,解压安装介质包进行部署集群;


8)安装 mysql 客户端命令包(mariadb);


9)编辑和读取数据库变量参数文件,对变量参数进行设置和对设置结果进行检查。


   TiDB部署助手工具目录结构
复制代码


   工具下载链接:<https://github.com/dxhmxt/TiDB-deploy-tool>
复制代码

部署工具使用手册

部署工具安装

在 tiup 节点 root 用户 /root/ 目录下,执行以下部署命令:


tar zxf tidbdeploy-v1.x.x.tarsh /root/tidbdeploy/scripts/00_tidb_deploy_text_menu.sh
复制代码


输入菜单数字,进入编辑集群部署初始配置文件菜单


 ____________________________________________________ |                   TiDB部署工具                      ||===================部署相关步骤=======================||          1.编辑集群部署相关配置文件                    ||          2.设置系统root用户互信                       ||          3.初始化操作系统参数                         ||          4.挂载数据盘                                ||          5.创建集群实例用户和设置互信                   ||          6.生成yaml配置文件                          ||          7.部署集群                                 ||          8.设置数据库root用户密码                     ||          9.初始化数据库参数                           ||          10.TiDB部署工具介绍和部署说明                 ||————————————————————————————————————————————————————||          99.退出                                    ||          请输入选项:                                ||____________________________________________________|    1|—————————————————————————————————————————————————||            1.编辑集群部署相关配置文件               ||—————————————————————————————————————————————————||          1.1 编辑集群部署初始配置文件               ||          1.2 集群拓扑规划模板1-最小配置             ||          1.3 集群拓扑规划模板2-简单配置             ||          1.4 集群拓扑规划模板3-详细配置             ||          1.5 编辑集群拓扑规划文件                  ||          1.6 快速生成相同架构集群拓扑规划文件        ||          1.7 编辑集群ip列表                       ||—————————————————————————————————————————————————||          99.退出                                 ||          请输入选项:                             ||_________________________________________________|
复制代码

编辑集群配置文件

接上面菜单,选 1,把集群的基本信息输入进去:



编辑集群部署初始配置文件 [y/n]y 你选择了 是 编辑集群初始配置文件Vim: 警告: 输出不是到终端(屏幕)#实例用户tidbInstanceUser=tidbtidbInstanceUserPassword=123456dirHome=/data1/tidb
#ssh端口,支持非默认端口,如36000sshPort=22
#集群规划信息,arch为amd64或者arm64version=v6.5.4arch=amd64clusterName=tidb-test
#部署并发,默认的是5,根据集群规模可调整concurrencyint=10

#介质名称serverPackage=tidb-community-server-v6.5.4-linux-amd64.tar.gztoolkitPackage=tidb-community-toolkit-v6.5.4-linux-amd64.tar.gz
#变量communityOrEnterpriseVersion表示安装包是community还是enterprise版本communityOrEnterpriseVersion=community
#tidb database 用户tidbDatabaseUserRoot=roottidbDatabaseUserRootPassword=passwd
#grafana user passwd设置 grafanaUserPassword=passwd~
复制代码

快速生成部署文件

这里拿简单配置做介绍:


|—————————————————————————————————————————————————||            1.编辑集群部署相关配置文件               ||—————————————————————————————————————————————————||          1.1 编辑集群部署初始配置文件               ||          1.2 集群拓扑规划模板1-最小配置             ||          1.3 集群拓扑规划模板2-简单配置             ||          1.4 集群拓扑规划模板3-详细配置             ||          1.5 编辑集群拓扑规划文件                  ||          1.6 快速生成相同架构集群拓扑规划文件        ||          1.7 编辑集群ip列表                       ||—————————————————————————————————————————————————||          99.退出                                 ||          请输入选项:                             ||_________________________________________________|
输入 1.3
集群拓扑规划模板2 [y/n]y
输出如下:
#模板2#注意每个role的Port1、Port2、Data Dir、Deploy Dir四个要素必须填完整;例如,部分role端口和目录不涉及的用"-"填充;tiflash因为默认端口多,采用一个Host部署一个节点,采用"-"填充。 #Host Role Port1 Port2 Data Dir Deploy Dir 192.168.1.77 pd 2379 2380 /data1/tidb-data/pd-2379 /data1/tidb-deploy/pd-2379 192.168.1.88 pd 2379 2380 /data1/tidb-data/pd-2379 /data1/tidb-deploy/pd-2379 192.168.1.99 pd 2379 2380 /data1/tidb-data/pd-2379 /data1/tidb-deploy/pd-2379 192.168.1.11 tikv 20160 20180 /data1/tidb-data/tikv-20160 /data1/tidb-deploy/tikv-20160 192.168.1.11 tikv 20161 20181 /data1/tidb-data/tikv-20161 /data1/tidb-deploy/tikv-20161 192.168.1.22 tikv 20160 20180 /data1/tidb-data/tikv-20160 /data1/tidb-deploy/tikv-20160 192.168.1.22 tikv 20161 20181 /data1/tidb-data/tikv-20161 /data1/tidb-deploy/tikv-20161 192.168.1.12 tidb 4000 10080 - /data1/tidb-deploy/tidb-4000 192.168.1.12 tidb 4001 10081 - /data1/tidb-deploy/tidb-4001 192.168.1.14 drainer 8249 - /data1/tidb-data/drainer-8250 /data1/tidb-deploy/drainer-8250 192.168.1.15 pump 8250 - /data1/tidb-data/pump-8250 /data1/tidb-deploy/pump-8250 192.168.1.16 cdc 8300 - /data1/tidb-data/cdc-8300 /data1/tidb-deploy/cdc-8300 192.168.1.19 prometheus 9090 12020 /data1/tidb-data/prometheus-9090 /data1/tidb-data/prometheus-9090 192.168.1.19 grafana 3000 - - /data1/tidb-deploy/grafana-3000 192.168.1.17 tispark_masters 7077 8080 - /data1/tidb-deploy/tispark_masters-7077192.168.1.17 tispark_workers 7078 8081 - /data1/tidb-deploy/tispark_masters-7078192.168.1.66 tiflash - - /data1/tidb-data/tiflash-9000 /data1/tidb-deploy/tiflash-9000192.168.1.19 alertmanager 9093 9394 /data1/tidb-data/alertmanager-9093 /data1/tidb-deploy/alertmanager-9093
#模板2 转换成yaml格式结果 pd_servers: - host: 192.168.1.77 client_port: 2379 peer_port: 2380 deploy_dir: /data1/tidb-deploy/pd-2379 data_dir: /data1/tidb-data/pd-2379 - host: 192.168.1.88 client_port: 2379 peer_port: 2380 deploy_dir: /data1/tidb-deploy/pd-2379 data_dir: /data1/tidb-data/pd-2379 - host: 192.168.1.99 client_port: 2379 peer_port: 2380 deploy_dir: /data1/tidb-deploy/pd-2379 data_dir: /data1/tidb-data/pd-2379tikv_servers: - host: 192.168.1.11 port: 20160 status_port: 20180 deploy_dir: /data1/tidb-deploy/tikv-20160 data_dir: /data1/tidb-data/tikv-20160 - host: 192.168.1.11 port: 20161 status_port: 20181 deploy_dir: /data1/tidb-deploy/tikv-20161 data_dir: /data1/tidb-data/tikv-20161 - host: 192.168.1.22 port: 20160 status_port: 20180 deploy_dir: /data1/tidb-deploy/tikv-20160 data_dir: /data1/tidb-data/tikv-20160 - host: 192.168.1.22 port: 20161 status_port: 20181 deploy_dir: /data1/tidb-deploy/tikv-20161 data_dir: /data1/tidb-data/tikv-20161tidb_servers: - host: 192.168.1.12 port: 4000 status_port: 10080 deploy_dir: /data1/tidb-deploy/tidb-4000 - host: 192.168.1.12 port: 4001 status_port: 10081 deploy_dir: /data1/tidb-deploy/tidb-4001drainer_servers: - host: 192.168.1.14 port: 8249 deploy_dir: /data1/tidb-deploy/drainer-8250 data_dir: /data1/tidb-data/drainer-8250 config: syncer.db-type: file syncer.to.retention-time: 2 syncer.to.read-timeout: 24hpump_servers: - host: 192.168.1.15 port: 8250 deploy_dir: /data1/tidb-deploy/pump-8250 data_dir: /data1/tidb-data/pump-8250cdc_servers: - host: 192.168.1.16 port: 8300 deploy_dir: /data1/tidb-deploy/cdc-8300 data_dir: /data1/tidb-data/cdc-8300monitoring_servers: - host: 192.168.1.19 port: 9090 deploy_dir: /data1/tidb-data/prometheus-9090 data_dir: /data1/tidb-data/prometheus-9090grafana_servers: - host: 192.168.1.19 port: 3000 deploy_dir: /data1/tidb-deploy/grafana-3000 username: admin password: admintispark_masters: - host: 192.168.1.17 port: 7077 web_port: 8080 deploy_dir: /data1/tidb-deploy/tispark_masters-7077tispark_workers: - host: 192.168.1.17 port: 7078 web_port: 8081 deploy_dir: /data1/tidb-deploy/tispark_masters-7078tiflash_servers: - host: 192.168.1.66 deploy_dir: /data1/tidb-deploy/tiflash-9000 data_dir: /data1/tidb-data/tiflash-9000alertmanager_servers: - host: 192.168.1.19 web_port: 9093 cluster_port: 9394 deploy_dir: /data1/tidb-deploy/alertmanager-9093 data_dir: /data1/tidb-data/alertmanager-9093 输入任意键继续
复制代码

修改操作系统配置文件

修改 sysctl.conf、limits.conf 等配置文件


 ____________________________________________________ |                   TiDB部署工具                      ||===================部署相关步骤=======================||          1.编辑集群部署相关配置文件                    ||          2.设置系统root用户互信                       ||          3.初始化操作系统参数                         ||          4.挂载数据盘                                ||          5.创建集群实例用户和设置互信                   ||          6.生成yaml配置文件                          ||          7.部署集群                                 ||          8.设置数据库root用户密码                     ||          9.初始化数据库参数                           ||          10.TiDB部署工具介绍和部署说明                 ||————————————————————————————————————————————————————||          99.退出                                    ||          请输入选项:                                ||____________________________________________________|输入 3
##cluster instance user is tidb.###set 172.16.4.126 optimal parameters.###vm.swappiness need to delete,and new add vm.swappiness = 0.delete vm.swappiness through sed matching.delete vm.swappiness done.starting set disableswap.disableswap set done.selinuxstate check and disable set.Disabledselinux state is disabled.starting set kernelset.kernelset set done.tidb limitsset is set.starting set limitsset.limitsset set done.starting set tidbInstanceUsersudoset.tidb sudo grant is set.tidbInstanceUsersudoset set done.this is not kylin-release system. will be cpup and thp set.backup /etc/tuned/balanced-tidb-optimal/tuned.conf to /etc/tuned/balanced-tidb-optimal/tuned.conf.bak.machine type check.machine type is virtual machine.virtual machine thp set done,TIPS restart the system setting takes effect.#############start check os optimal parameters set##############check swappinessdisableset.vm.swappiness = 0##check seliunxdisableset.Disabled##check kernelset.fs.file-max = 1000000net.core.somaxconn = 32768net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_syncookies = 0vm.overcommit_memory = 1##check limitsset.tidb soft nofile 1000000tidb hard nofile 1000000tidb soft stack 32768tidb hard stack 32768##check tidbInstanceUsersudoset.tidb ALL=(ALL) NOPASSWD: ALL##check cpuper_and_thp_set.[main]include=balanced
[vm]transparent_hugepage=never
###set 172.16.4.163 optimal parameters.###vm.swappiness need to delete,and new add vm.swappiness = 0.delete vm.swappiness through sed matching.delete vm.swappiness done.starting set disableswap.disableswap set done.selinuxstate check and disable set.Disabledselinux state is disabled.starting set kernelset.kernelset set done.tidb limitsset is set.starting set limitsset.limitsset set done.starting set tidbInstanceUsersudoset.tidb sudo grant is set.tidbInstanceUsersudoset set done.this is not kylin-release system. will be cpup and thp set.backup /etc/tuned/balanced-tidb-optimal/tuned.conf to /etc/tuned/balanced-tidb-optimal/tuned.conf.bak.machine type check.machine type is virtual machine.virtual machine thp set done,TIPS restart the system setting takes effect.#############start check os optimal parameters set##############check swappinessdisableset.vm.swappiness = 0##check seliunxdisableset.Disabled##check kernelset.fs.file-max = 1000000net.core.somaxconn = 32768net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_syncookies = 0vm.overcommit_memory = 1##check limitsset.tidb soft nofile 1000000tidb hard nofile 1000000tidb soft stack 32768tidb hard stack 32768##check tidbInstanceUsersudoset.tidb ALL=(ALL) NOPASSWD: ALL##check cpuper_and_thp_set.[main]include=balanced
[vm]transparent_hugepage=never
###set 172.16.4.169 optimal parameters.###vm.swappiness need to delete,and new add vm.swappiness = 0.delete vm.swappiness through sed matching.delete vm.swappiness done.starting set disableswap.disableswap set done.selinuxstate check and disable set.Disabledselinux state is disabled.starting set kernelset.kernelset set done.tidb limitsset is set.starting set limitsset.limitsset set done.starting set tidbInstanceUsersudoset.tidb sudo grant is set.tidbInstanceUsersudoset set done.this is not kylin-release system. will be cpup and thp set.backup /etc/tuned/balanced-tidb-optimal/tuned.conf to /etc/tuned/balanced-tidb-optimal/tuned.conf.bak.machine type check.machine type is virtual machine.virtual machine thp set done,TIPS restart the system setting takes effect.#############start check os optimal parameters set##############check swappinessdisableset.vm.swappiness = 0##check seliunxdisableset.Disabled##check kernelset.fs.file-max = 1000000net.core.somaxconn = 32768net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_syncookies = 0vm.overcommit_memory = 1##check limitsset.tidb soft nofile 1000000tidb hard nofile 1000000tidb soft stack 32768tidb hard stack 32768##check tidbInstanceUsersudoset.tidb ALL=(ALL) NOPASSWD: ALL##check cpuper_and_thp_set.[main]include=balanced
[vm]transparent_hugepage=never
###set 172.16.4.184 optimal parameters.###vm.swappiness need to delete,and new add vm.swappiness = 0.delete vm.swappiness through sed matching.delete vm.swappiness done.starting set disableswap.disableswap set done.selinuxstate check and disable set.Disabledselinux state is disabled.starting set kernelset.kernelset set done.delete unnecessary tidbInstanceUser tidb limitsset infostarting set limitsset.limitsset set done.starting set tidbInstanceUsersudoset.tidb sudo grant is set.tidbInstanceUsersudoset set done.this is not kylin-release system. will be cpup and thp set.backup /etc/tuned/balanced-tidb-optimal/tuned.conf to /etc/tuned/balanced-tidb-optimal/tuned.conf.bak.machine type check.machine type is virtual machine.virtual machine thp set done,TIPS restart the system setting takes effect.#############start check os optimal parameters set##############check swappinessdisableset.vm.swappiness = 0##check seliunxdisableset.Disabled##check kernelset.fs.file-max = 1000000net.core.somaxconn = 32768net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_syncookies = 0vm.overcommit_memory = 1##check limitsset.tidb soft nofile 1000000tidb hard nofile 1000000tidb soft stack 32768tidb hard stack 32768##check tidbInstanceUsersudoset.tidb ALL=(ALL) NOPASSWD: ALL##check cpuper_and_thp_set.[main]include=balanced
[vm]transparent_hugepage=never
###set 172.16.4.207 optimal parameters.###vm.swappiness need to delete,and new add vm.swappiness = 0.delete vm.swappiness through sed matching.delete vm.swappiness done.starting set disableswap.disableswap set done.selinuxstate check and disable set.Disabledselinux state is disabled.starting set kernelset.kernelset set done.tidb limitsset is set.starting set limitsset.limitsset set done.starting set tidbInstanceUsersudoset.tidb sudo grant is set.tidbInstanceUsersudoset set done.this is not kylin-release system. will be cpup and thp set.backup /etc/tuned/balanced-tidb-optimal/tuned.conf to /etc/tuned/balanced-tidb-optimal/tuned.conf.bak.machine type check.machine type is virtual machine.virtual machine thp set done,TIPS restart the system setting takes effect.#############start check os optimal parameters set##############check swappinessdisableset.vm.swappiness = 0##check seliunxdisableset.Disabled##check kernelset.fs.file-max = 1000000net.core.somaxconn = 32768net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_syncookies = 0vm.overcommit_memory = 1##check limitsset.tidb soft nofile 1000000tidb hard nofile 1000000tidb soft stack 32768tidb hard stack 32768##check tidbInstanceUsersudoset.tidb ALL=(ALL) NOPASSWD: ALL##check cpuper_and_thp_set.[main]include=balanced
[vm]transparent_hugepage=never
###set 172.16.4.212 optimal parameters.###vm.swappiness need to delete,and new add vm.swappiness = 0.delete vm.swappiness through sed matching.delete vm.swappiness done.starting set disableswap.disableswap set done.selinuxstate check and disable set.Disabledselinux state is disabled.starting set kernelset.kernelset set done.tidb limitsset is set.starting set limitsset.limitsset set done.starting set tidbInstanceUsersudoset.tidb sudo grant is set.tidbInstanceUsersudoset set done.this is not kylin-release system. will be cpup and thp set.backup /etc/tuned/balanced-tidb-optimal/tuned.conf to /etc/tuned/balanced-tidb-optimal/tuned.conf.bak.machine type check.machine type is virtual machine.virtual machine thp set done,TIPS restart the system setting takes effect.#############start check os optimal parameters set##############check swappinessdisableset.vm.swappiness = 0##check seliunxdisableset.Disabled##check kernelset.fs.file-max = 1000000net.core.somaxconn = 32768net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_syncookies = 0vm.overcommit_memory = 1##check limitsset.tidb soft nofile 1000000tidb hard nofile 1000000tidb soft stack 32768tidb hard stack 32768##check tidbInstanceUsersudoset.tidb ALL=(ALL) NOPASSWD: ALL##check cpuper_and_thp_set.[main]include=balanced
[vm]transparent_hugepage=never
###set 172.16.4.214 optimal parameters.###vm.swappiness need to delete,and new add vm.swappiness = 0.delete vm.swappiness through sed matching.delete vm.swappiness done.starting set disableswap.disableswap set done.selinuxstate check and disable set.Disabledselinux state is disabled.starting set kernelset.kernelset set done.tidb limitsset is set.starting set limitsset.limitsset set done.starting set tidbInstanceUsersudoset.tidb sudo grant is set.tidbInstanceUsersudoset set done.this is not kylin-release system. will be cpup and thp set.backup /etc/tuned/balanced-tidb-optimal/tuned.conf to /etc/tuned/balanced-tidb-optimal/tuned.conf.bak.machine type check.machine type is virtual machine.virtual machine thp set done,TIPS restart the system setting takes effect.#############start check os optimal parameters set##############check swappinessdisableset.vm.swappiness = 0##check seliunxdisableset.Disabled##check kernelset.fs.file-max = 1000000net.core.somaxconn = 32768net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_syncookies = 0vm.overcommit_memory = 1##check limitsset.tidb soft nofile 1000000tidb hard nofile 1000000tidb soft stack 32768tidb hard stack 32768##check tidbInstanceUsersudoset.tidb ALL=(ALL) NOPASSWD: ALL##check cpuper_and_thp_set.[main]include=balanced
[vm]transparent_hugepage=never
2023-02-03T11:37:25 cluster all ip set os optimal parameters is done.


复制代码

配置互信

配置 tidb 用户之间的互信


|—————————————————————————————————————————————————||            5.设置集群实例用户互信               ||—————————————————————————————————————————————————||          5.1 创建集群实例用户                   ||          5.2 设置集群实例用户互信               ||          5.3 检查集群实例用户互信               ||—————————————————————————————————————————————————||          99.退出                                ||          请输入选项:                           ||_________________________________________________|5.2
设置集群实例用户互信 [y/n]y 你选择了 是
输出如下:
set instance user huxin.Generating public/private rsa key pair.Created directory '/data1/tidb/.ssh'.Your identification has been saved in /data1/tidb/.ssh/id_rsa.Your public key has been saved in /data1/tidb/.ssh/id_rsa.pub.The key fingerprint is:SHA256:yPegbvTcN3qiXHCIO2ZYkK9DymUma2gTJPsVRI1Gyp0 tidb@CentOS76_VMThe key's randomart image is:+---[RSA 2048]----+| o+o || . +oo. ||..o.E ||o. = o . ||... * * S . || +.X +.+ = ||.o* +.*o .o ||... =.oo.o + || .. o..= . |+----[SHA256]-----+set instance user huxin.172.16.4.126spawn ssh-copy-id -o StrictHostKeyChecking=no tidb@172.16.4.126/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/data1/tidb/.ssh/id_rsa.pub"/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keystidb@172.16.4.126's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -o 'StrictHostKeyChecking=no' 'tidb@172.16.4.126'"and check to make sure that only the key(s) you wanted were added.
172.16.4.163spawn ssh-copy-id -o StrictHostKeyChecking=no tidb@172.16.4.163/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/data1/tidb/.ssh/id_rsa.pub"/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keystidb@172.16.4.163's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -o 'StrictHostKeyChecking=no' 'tidb@172.16.4.163'"and check to make sure that only the key(s) you wanted were added.
172.16.4.169spawn ssh-copy-id -o StrictHostKeyChecking=no tidb@172.16.4.169/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/data1/tidb/.ssh/id_rsa.pub"/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keystidb@172.16.4.169's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -o 'StrictHostKeyChecking=no' 'tidb@172.16.4.169'"and check to make sure that only the key(s) you wanted were added.
172.16.4.184spawn ssh-copy-id -o StrictHostKeyChecking=no tidb@172.16.4.184/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/data1/tidb/.ssh/id_rsa.pub"/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keystidb@172.16.4.184's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -o 'StrictHostKeyChecking=no' 'tidb@172.16.4.184'"and check to make sure that only the key(s) you wanted were added.
172.16.4.207spawn ssh-copy-id -o StrictHostKeyChecking=no tidb@172.16.4.207/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/data1/tidb/.ssh/id_rsa.pub"/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keystidb@172.16.4.207's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -o 'StrictHostKeyChecking=no' 'tidb@172.16.4.207'"and check to make sure that only the key(s) you wanted were added.
172.16.4.212spawn ssh-copy-id -o StrictHostKeyChecking=no tidb@172.16.4.212/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/data1/tidb/.ssh/id_rsa.pub"/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keystidb@172.16.4.212's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -o 'StrictHostKeyChecking=no' 'tidb@172.16.4.212'"and check to make sure that only the key(s) you wanted were added.
172.16.4.214spawn ssh-copy-id -o StrictHostKeyChecking=no tidb@172.16.4.214/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/data1/tidb/.ssh/id_rsa.pub"/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keystidb@172.16.4.214's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -o 'StrictHostKeyChecking=no' 'tidb@172.16.4.214'"and check to make sure that only the key(s) you wanted were added.


复制代码

修改数据库参数

 ____________________________________________________ |                   TiDB部署工具                     ||===================部署相关步骤=====================||          1.编辑集群部署相关配置文件                ||          2.设置系统root用户互信                    ||          3.初始化操作系统参数                      ||          4.挂载数据盘                              ||          5.创建集群实例用户和设置互信              ||          6.生成yaml配置文件                        ||          7.部署集群                                ||          8.设置数据库root用户密码                  ||          9.初始化数据库参数                        ||          10.TiDB部署工具介绍和部署说明             ||————————————————————————————————————————————————————||          99.退出                                   ||          请输入选项:                              ||____________________________________________________|9
|—————————————————————————————————————————————————|| 9.初始化数据库变量参数 ||—————————————————————————————————————————————————|| 9.1 编辑数据库变量参数文件 || 9.2 初始化数据库变量参数 ||—————————————————————————————————————————————————|| 99.退出 || 请输入选项: ||_________________________________________________|9.1
编辑数据库变量参数文件 [y/n]y 你选择了 是 编辑数据库变量参数文件tidbinitvar.txt
输出如下:
编辑数据库变量参数文件tidbinitvar.txtVim: 警告: 输出不是到终端(屏幕)set global transaction_isolation='READ-COMMITTED';set global tidb_auto_analyze_start_time='22:00 +0800';set global tidb_auto_analyze_end_time='04:00 +0800';set global tidb_enable_clustered_index=off;~
~"~/tidbdeploy/conf/tidbinitvar.txt" [新] 5L, 273C 已写入 输入任意键继续

初始化数据库变量参数|—————————————————————————————————————————————————|| 9.初始化数据库变量参数 ||—————————————————————————————————————————————————|| 9.1 编辑数据库变量参数文件 || 9.2 初始化数据库变量参数 ||—————————————————————————————————————————————————|| 99.退出 || 请输入选项: ||_________________________________________________|9.2
初始化数据库变量参数 [y/n]y 你选择了 是
日志输出如下:
cpoy conf script file to /data1/qqtidb.chown conf and script file instance user grant.initialize database variable parameters.Starting component `cluster`: /data1/qqtidb/.tiup/components/cluster/v1.5.6/tiup-cluster display ccbStarting component `cluster`: /data1/qqtidb/.tiup/components/cluster/v1.5.6/tiup-cluster display ccbset global transaction_isolation='READ-COMMITTED';set global tidb_auto_analyze_start_time='22:00 +0800';set global tidb_auto_analyze_end_time='04:00 +0800';set global tidb_enable_clustered_index=off;initialize database variable parameters is done.###############################################check initialize variable parameters.@@transaction_isolationREAD-COMMITTED###next row check.@@tidb_auto_analyze_start_time22:00 +0800###next row check.@@tidb_auto_analyze_end_time04:00 +0800###next row check.@@tidb_gc_life_time24h0m0s###next row check.@@tidb_enable_clustered_indexOFF###next row check. 输入任意键继续
复制代码

总结和思考

1、上百台节点的集群部署,使用工具生成配置文件会带来很大便利;


2、重复性的工作用工具来代替,提供效率。


发布于: 刚刚阅读数: 3
用户头像

TiDB 社区官网:https://tidb.net/ 2021-12-15 加入

TiDB 社区干货传送门是由 TiDB 社区中布道师组委会自发组织的 TiDB 社区优质内容对外宣布的栏目,旨在加深 TiDBer 之间的交流和学习。一起构建有爱、互助、共创共建的 TiDB 社区 https://tidb.net/

评论

发布
暂无评论
TiDB快速部署工具_实践案例_TiDB 社区干货传送门_InfoQ写作社区