03-TiDB-单机上模拟部署生产环境集群

1、安装集群cluster组件

 

tiup cluster
# 已安装的可以更新 
# tiup update --self && tiup update cluster

2、修改主机sshd 服务的连接数限制

vim  /etc/ssh/sshd_config 

# MaxSessions 20

#重启 sshd 服务:
service sshd restart

3、设置集群配置文件topo.yml

# # 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: "/tidb-deploy"
 data_dir: "/tidb-data"

# # Monitored variables are applied to all the machines.
monitored:
 node_exporter_port: 9100
 blackbox_exporter_port: 9115

server_configs:
 tidb:
   instance.tidb_slow_log_threshold: 300
 tikv:
   readpool.storage.use-unified-pool: false
   readpool.coprocessor.use-unified-pool: true
 pd:
   replication.enable-placement-rules: true
   replication.location-labels: ["host"]
 tiflash:
   logger.level: "info"

pd_servers:
 - host: 192.168.20.113

tidb_servers:
 - host: 192.168.20.113

tikv_servers:
 - host: 192.168.20.113
   port: 20160
   status_port: 20180
   config:
     server.labels: { host: "logic-host-1" }

 - host: 192.168.20.113
   port: 20161
   status_port: 20181
   config:
     server.labels: { host: "logic-host-2" }

 - host: 192.168.20.113
   port: 20162
   status_port: 20182
   config:
     server.labels: { host: "logic-host-3" }

tiflash_servers:
 - host: 192.168.20.113

monitoring_servers:
 - host: 192.168.20.113

grafana_servers:
 - host: 192.168.20.113

4、集群部署命令

cd /home/server/tidb
# 上传topo.yml 文件
# 指定集群名称 和 版本。使用 tiup list tidb 命令查看当前服务器支持的版本
tiup cluster deploy xuancg-test v7.5.0 ./topo.yml --user root -p

下载程序中...

5、启动集群:

tiup cluster start xuancg-test

6、访问集群:

  • 使用mysql 访问 TiDB 数据库,密码为空:

建议直接使用navicat等数据库连接工具

mysql -h 192.168.1.1 -P 4000 -u root

通过 http://{grafana-ip}:3000 访问集群 Grafana 监控页面,默认用户名和密码均为 admin。

通过 http://{pd-ip}:2379/dashboard 访问集群 TiDB Dashboard 监控页面,默认用户名为 root,密码为空。

  • 执行以下命令确认当前已经部署的集群列表:
tiup cluster list
  • 执行以下命令查看集群的拓扑结构和状态:
tiup cluster display <cluster-name>

相关推荐

  1. Zookeeper部署单机部署

    2024-01-29 13:32:03       31 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-29 13:32:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-29 13:32:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-29 13:32:03       82 阅读
  4. Python语言-面向对象

    2024-01-29 13:32:03       91 阅读

热门阅读

  1. Shell脚本转发activemg topic消息到另个activemg服务器

    2024-01-29 13:32:03       57 阅读
  2. STL容器大总结区分(下)

    2024-01-29 13:32:03       39 阅读
  3. 详解微服务

    2024-01-29 13:32:03       48 阅读
  4. Unity显示物体的边框

    2024-01-29 13:32:03       52 阅读
  5. 面试经典题---30.串联所有单词的子串

    2024-01-29 13:32:03       45 阅读
  6. 2024/1/28 备战蓝桥杯 1-3

    2024-01-29 13:32:03       51 阅读
  7. python—基础知识补充

    2024-01-29 13:32:03       53 阅读
  8. 网络爬虫的基本原理、应用场景及注意事项

    2024-01-29 13:32:03       53 阅读
  9. Unity2D_角色移动&跳跃

    2024-01-29 13:32:03       53 阅读
  10. Uboot中ARMV7和ARMV8 MMU配置

    2024-01-29 13:32:03       43 阅读
  11. 【微信小程序框架的详细介绍】

    2024-01-29 13:32:03       58 阅读