Skip to content

TiDB 安装部署

集群规划

tidb集群需要至少以下节点。

节点内存CPU磁盘节点数量
Tidb48G16200G2
PD16G8200G3
tikv64G16100G + 1T3
tiflash64G16100G + 1T2
tiup3216G200G1
Monitoring16G8500G1

系统配置

安装ntp

# 安装ntp
yum install ntp
vi /etc/ntp.conf

# 修改内容
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server ntp3.aliyun.com iburst

# 保存重启
systemctl start ntpd
systemctl enable ntpd

关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

关闭swap

swapoff -a

vi /etc/sysctl.conf
#修改 vm.swappiness 的修改为 0
vm.swappiness=0
# 使配置生效
sysctl -p

优化系统参数(仅需在tikv和tiflash执行)

fdisk -l
parted -s -a optimal /dev/sdb mklabel gpt -- mkpart primary ext4 1 -1
mkfs.ext4 /dev/sdb

lsblk -f
#查看UUID=aa65467d-89a0-4e22-9b03-b06a07792036后修改

vi /etc/fstab
#添加的内容
UUID=aa65467d-89a0-4e22-9b03-b06a07792036 /data1 ext4 defaults,nodelalloc,noatime 0 2

mkdir /data1 && mount -a
#查看挂载
df -h

部署TiDB

安装TiUP

集群配置文件

执行部署

版本升级