tidb的安装配置规划
侧边栏壁纸
博主昵称
yuc

  • 累计撰写 291 篇文章
  • 累计收到 0 条评论

tidb的安装配置规划

yuc
yuc
2023-08-24 / 最后修改: 2023-08-24 09:09 / 0 评论 / 4 阅读 / 正在检测是否收录...
0x1 参考文档

软硬件环境和端口

https://docs.pingcap.com/zh/tidb/stable/hardware-and-software-requirements

https://docs.pingcap.com/zh/tidb/stable/high-concurrency-best-practices

tiflash运维文档

https://docs.pingcap.com/zh/tidb/stable/maintain-tiflash
0x2 前置要求
  • 关闭swap

  • 关闭透明大页

  • ntp

  • 防火墙

  • io调度器为noop或者none,跟内核版本有关系

  • cpu频率为performance

  • 关闭selinux

  • 选择支持epollexclusive的内核版本

  • 网卡速率不低于千兆

  • sysctl

    echo "fs.file-max = 1000000">> /etc/sysctl.conf
    echo "net.core.somaxconn = 32768">> /etc/sysctl.conf
    echo "net.ipv4.tcp_tw_recycle = 0">> /etc/sysctl.conf
    echo "net.ipv4.tcp_syncookies = 0">> /etc/sysctl.conf
    echo "vm.overcommit_memory = 1">> /etc/sysctl.conf
    sysctl -p
    
  • ulimit

    cat << EOF >>/etc/security/limits.conf
    tidb           soft    nofile          1000000
    tidb           hard    nofile          1000000
    tidb           soft    stack          32768
    tidb           hard    stack          32768
    EOF
    
0x3 安装维护
  • 安装模板

    global:
    user: "tidb"
    ssh_port: 22
    deploy_dir: "/data/tidb-deploy"
    data_dir: "/data/tidb-data"
    arch: "amd64"
    monitored:
    node_exporter_port: 9100
    blackbox_exporter_port: 9115
    pd_servers:
    - host: 10.8.16.92
    - host: 10.8.16.93
    - host: 10.8.16.94
    tidb_servers:
    - host: 10.8.16.92
    - host: 10.8.16.93
    - host: 10.8.16.94
    tikv_servers:
    - host: 10.8.16.95
    - host: 10.8.16.96
    - host: 10.8.16.97
    tiflash_servers:
    - host: 10.8.16.98
    - host: 10.8.16.99
    monitoring_servers:
    - host: 10.8.16.91
    grafana_servers:
    - host: 10.8.16.91
    alertmanager_servers:
    - host: 10.8.16.91
    

安装前检测

tiup cluster check ./topology.yaml --user root --password

尝试修复

tiup cluster check ./topology.yaml --apply --user root --password

查询可以安装的版本列表

tiup list tidb

执行安装

tiup cluster deploy tidb-succez v5.2.1 ./topology.yaml  --user root --password

启动

tiup cluster start tidb-succez

查询状态

tiup cluster display tidb-succez

查询kvstore状态

select STORE_ID,ADDRESS,STORE_STATE,STORE_STATE_NAME,CAPACITY,AVAILABLE,UPTIME from INFORMATION_SCHEMA.TIKV_STORE_STATUS;

一些优化

server_configs:
  tidb:
    log.level: error
    log.slow-threshold: 300
    oom-action: cancel
    performance.max-procs: 20
    performance.txn-total-size-limit: 10737418240
    prepared-plan-cache.enabled: true
    tikv-client.max-batch-wait-time: 2000000
  tikv:
    log-level: error
    pessimistic-txn.pipelined: true
    raftdb.allow-concurrent-memtable-write: true
    raftdb.max-background-jobs: 16
    raftstore.apply-max-batch-size: 2048
    raftstore.apply-pool-size: 3
    raftstore.store-max-batch-size: 2048
    raftstore.store-pool-size: 3
    readpool.coprocessor.use-unified-pool: true
    readpool.storage.normal-concurrency: 10
    readpool.storage.use-unified-pool: false
    readpool.unified.max-thread-count: 20
    readpool.unified.min-thread-count: 5
    rocksdb.max-background-jobs: 28
    server.enable-request-batch: false
    server.grpc-concurrency: 6
    storage.scheduler-worker-pool-size: 20
  pd:
    replication.enable-placement-rules: true
    schedule.leader-schedule-limit: 4
    schedule.region-schedule-limit: 2048
    schedule.replica-schedule-limit: 64
  tiflash:
    profiles.default.max_memory_usage: 0
    profiles.default.max_memory_usage_for_all_queries: 0
0

评论

博主关闭了当前页面的评论