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

1、安装集群cluster组件

 

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

03-TiDB-单机上模拟部署生产环境集群_第1张图片

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

下载程序中...

03-TiDB-单机上模拟部署生产环境集群_第2张图片

03-TiDB-单机上模拟部署生产环境集群_第3张图片

5、启动集群:

tiup cluster start xuancg-test

03-TiDB-单机上模拟部署生产环境集群_第4张图片

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 

03-TiDB-单机上模拟部署生产环境集群_第5张图片

你可能感兴趣的:(TiDB分布式数据库,tidb,生产环境部署)