欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

TiDB安装与使用-安装

程序员文章站 2022-07-13 09:09:43
...

1、推荐以下配置

角色 配置 磁盘 数量 IP 说明
TiDB 8C64G HDD 500G 2

172.28.1.11

172.28.1.12

 
PD 4C8G HDD 200G 3

172.28.1.21

172.28.1.22

172.28.1.23

 
TiKV 8C64G SSD 2T 3

172.28.1.31

172.28.1.32

172.28.1.33

 
Pump 8C16G HDD 300G 3

172.28.1.41

172.28.1.42

172.28.1.43

binlog
Drainer 8C16G HDD 300G 1 172.28.1.44 binlog
Monitoring & Grafana 4C8G HDD 500G 1 172.28.1.51  
mysql 8C64G HDD 2T 2

172.28.1.61

172.28.1.62

备份用,主从架构

2、TiDB共13台服务器,使用Monitoring服务器172.28.1.51作为中控机服务器,在每台服务器上创建用户tidb,并设置密码(passwd tidb)、免密提权(echo "tidb ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers)

3、安装配置mysql主从

4、设置服务器互信(中控机172.28.1.51操作)

ssh-****** -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub TiDB各服务器IP

5、tiup安装

sudo su - tidb
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
source .bash_profile
tiup cluster

6、配置文件topology.yaml

# # Global variables are applied to all deployments and used as the default value of
# # the deployments if a specific deployment value is missing.
global:
  user: "tidb"
  ssh_port: 22
  deploy_dir: "/data/tidb-deploy"
  data_dir: "/data/tidb-data"

server_configs:
  pd:
    replication.enable-placement-rules: true
  tidb:
    binlog.enable: true
    binlog.ignore-error: true

pd_servers:
  - host: 172.28.1.21
  - host: 172.28.1.22
  - host: 172.28.1.23

tidb_servers:
  - host: 172.28.1.12
  - host: 172.28.1.13

tikv_servers:
  - host: 172.28.1.31
  - host: 172.28.1.32
  - host: 172.28.1.33

pump_servers:
  - host: 172.28.1.41
    data_dir: /data/tidb-data/drainer-8250
    deploy_dir: /data/tidb-deploy/drainer-8250
    config:
      gc: 7
  - host: 172.28.1.42
    data_dir: /data/tidb-data/drainer-8250
    deploy_dir: /data/tidb-deploy/drainer-8250
    config:
      gc: 7
  - host: 172.28.1.43
    data_dir: /data/tidb-data/drainer-8250
    deploy_dir: /data/tidb-deploy/drainer-8250
    config:
      gc: 7


drainer_servers:
  - host: 172.28.1.44
    port: 8249
    data_dir: /data/tidb-data/drainer-8249
    deploy_dir: /data/tidb-deploy/drainer-8249
    commit_ts: -1
    config:
      syncer.db-type: "mysql"
      syncer.to.host: "172.28.1.61"
      syncer.to.user: "root"
      syncer.to.password: "密码"
      syncer.to.port: 3306


monitoring_servers:
  - host: 172.28.1.51

grafana_servers:
  - host: 172.28.1.51

alertmanager_servers:
  - host: 172.28.1.51

7、执行集群部署

tiup cluster deploy 集群名称 v4.0.8 ./topology.yaml

8、查看集群状态(此时为down状态)

tiup cluster desplay 集群名称

9、启动集群

tiup cluster 集群名称 start

 

相关标签: TiDB 数据库