Appearance
TiDB 安装部署
集群规划
tidb集群需要至少以下节点。
| 节点 | 内存 | CPU | 磁盘 | 节点数量 |
|---|---|---|---|---|
| Tidb | 48G | 16 | 200G | 2 |
| PD | 16G | 8 | 200G | 3 |
| tikv | 64G | 16 | 100G + 1T | 3 |
| tiflash | 64G | 16 | 100G + 1T | 2 |
| tiup | 32 | 16G | 200G | 1 |
| Monitoring | 16G | 8 | 500G | 1 |
系统配置
安装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