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

tidb4.0.1安装

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

安装环境

3台redhat7.6 64 服务器

软硬件需求

系统要求

|Linux 操作系统平台 | 版本 |
|Red Hat Enterprise Linux | 7.3以上 |
| CentOS | 7.3以上 |
|Oracle Enterprise Linux | 7.3以上 |
|Ubuntu LTS | 16.04 及以上 |

软件需求

中控机需求

|软件| 版本|
|sshpass| 1.06 及以上|
|TiUP| 0.6.2 及以上|

目标主机需求
| 软件 | 版本 |
|sshpass | 1.06 及以上 |
|numa | 2.0.12 及以上 |

挂载参数

UUID=c51eb23b-195c-4061-92a9-3fad812cc12f /data1 ext4 defaults,nodelalloc,noatime 0 2
注:不加没有报错。网上说不加会报错

关闭swap

vim /etc/sysctl.conf
vm.swappiness = 0

关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

配置和安装NTP

参考官方文档

配置ssh**和sudo免密码

visudo
tidb ALL=(ALL) NOPASSWD: ALL
ssh-copy-id -i ~/.ssh/id_rsa.pub 10.0.1.1

以上所有节点都配置

安装tidb

使用离线包安装
tidb-community-server-v4.0.1-linux-amd64.tar.gz
tar zxf tidb-community-server-v4.0.1-linux-amd64.tar.gz

安装tiup

cd tidb-community-server-v4.0.1-linux-amd64
sh local_install.sh
source /root/.bash_profile

配置初始化参数

新建topology.yaml文件
vim topology.yaml

global:
  user: "tidb"
  ssh_port: 22
  deploy_dir: "/data/tidb-deploy"
  data_dir: "/data/tidb-data"

monitored:
  node_exporter_port: 9100
  blackbox_exporter_port: 9115

server_configs:
  tidb:
    log.slow-threshold: 300
    binlog.enable: false
    binlog.ignore-error: false
  tikv:
     server.grpc-concurrency: 8
     raftstore.apply-pool-size: 2
     raftstore.store-pool-size: 2
     rocksdb.max-sub-compactions: 2
     storage.block-cache.capacity: "16GB"
     readpool.unified.max-thread-count: 16
     readpool.storage.use-unified-pool: false
     readpool.coprocessor.use-unified-pool: true
  pd:
    schedule.leader-schedule-limit: 4
    schedule.region-schedule-limit: 2048
    schedule.replica-schedule-limit: 64
    replication.enable-placement-rules: true
  tiflash:
    path_realtime_mode: false
    logger.level: "info"
  tiflash-learner:
     log-level: "info"
     raftstore.apply-pool-size: 4
     raftstore.store-pool-size: 4
  pump:
    gc: 7

pd_servers:
  - host: 10.105.1.10
  - host: 10.105.1.103
  - host: 10.105.1.171

tidb_servers:
  - host: 10.105.1.10
  - host: 10.105.1.103
  - host: 10.105.1.171

tikv_servers:
  - host: 10.105.1.10
  - host: 10.105.1.103
  - host: 10.105.1.171

tiflash_servers:
 - host: 10.105.1.10
#pump_servers:
   #   - host: 10.0.1.17
   #     ssh_port: 22
   #     port: 8250
   #     deploy_dir: "/tidb-deploy/pump-8249"
   #     data_dir: "/tidb-data/pump-8249"
   #     log_dir: "/tidb-deploy/pump-8249/log"
   #     numa_node: "0,1"
   #     # The following configs are used to overwrite the `server_configs.drainer` values.
   #     config:
   #       gc: 7
   #   - host: 10.0.1.18
   #   - host: 10.0.1.19
   
   # drainer_servers:
   #   - host: 10.0.1.17
   #     port: 8249
   #     data_dir: "/tidb-data/drainer-8249"
   #     # If drainer doesn't have a checkpoint, use initial commitTS as the initial checkpoint.
   #     # Will get a latest timestamp from pd if commit_ts is set to -1 (the default value).
   #     commit_ts: -1
   #     deploy_dir: "/tidb-deploy/drainer-8249"
   #     log_dir: "/tidb-deploy/drainer-8249/log"
   #     numa_node: "0,1"
   #     # The following configs are used to overwrite the `server_configs.drainer` values.
   #     config:
   #       syncer.db-type: "mysql"
   #       syncer.to.host: "127.0.0.1"
   #       syncer.to.user: "root"
   #       syncer.to.password: ""
   #       syncer.to.port: 3306
   #       syncer.ignore-table:
   #         - db-name: test
   #           tbl-name: log
   #         - db-name: test
   #           tbl-name: audit
   #   - host: 10.0.1.19
   
   # cdc_servers:
   #   - host: 10.0.1.20
   #     ssh_port: 22
   #     port: 8300
   #     deploy_dir: "/tidb-deploy/cdc-8300"
   #     log_dir: "/tidb-deploy/cdc-8300/log"
   #     numa_node: "0,1"
   #   - host: 10.0.1.21
   #   - host: 10.0.1.22

monitoring_servers:
  - host: 10.105.1.10

grafana_servers:
  - host: 10.105.1.10

alertmanager_servers:
  - host: 10.105.1.10

部署集群

export TIUP_MIRRORS=/root/tidb-server --tidb安装包解压路径
tiup cluster deploy tidb-test v4.0.1 topology.yaml --user tidb [-p] [-i /home/root/.ssh/gcp_rsa] --没有配置免密码,需要两个参数其中一个。tidb-test 集群名,v4.0.1 版本 tidb 系统用户,没有建,在执行这段命令,会自动创建
tiup cluster start tidb-test --启动集群
看到如下信息就表示成功
Deployed cluster tidb-test successfully

相关标签: tidb 数据库