CentOS 7使用TiUP部署TiDB
创始人
2024-05-30 06:11:04
0

本文主要是根据官方文档指导,结合实际主机情况,在Cent OS7上使用TiUP在线部署TiDB。

环境说明

类型操作系统版本配置
中控机Deepin 20.34核CPU+6G内存+40G硬盘
TiDB部署机Cent OS 7.38核CPU+48G内存+100硬盘
网络情况中控机与外网相连,中控机与部署机网络互通

第一步:在中控机在线部署TiUP组件

# 安装TiUP工具
$ curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
# 重新声明全局环境变量
$ source .bash_profile
# 确认Tiup 是否安装
$ which tiup
/root/.tiup/bin/tiup
# 安装TiUP cluster组件
$ tiup cluster
# 查看TiUP cluster版本
$ tiup --binary cluster
/root/.tiup/components/cluster/v1.11.3/tiup-cluster

第二步:编写集群拓扑文件

## 全局变量,ssh端口要填写部署机实际的ssh端口
global:user: "tidb"ssh_port: 2333deploy_dir: "/tidb-deploy"data_dir: "/tidb-data"
# # Monitored variables are applied to all the machines.
monitored:node_exporter_port: 9100blackbox_exporter_port: 9115server_configs:tidb:log.slow-threshold: 300tikv:readpool.storage.use-unified-pool: falsereadpool.coprocessor.use-unified-pool: truepd:replication.enable-placement-rules: truereplication.location-labels: ["host"]
pd_servers:- host: 192.168.58.10tidb_servers:- host: 192.168.58.10tikv_servers:- host: 192.168.58.10port: 20160status_port: 20180config:server.labels: { host: "logic-host-1" }- host: 192.168.58.10port: 20161status_port: 20181config:server.labels: { host: "logic-host-2" }- host: 192.168.58.10port: 20162status_port: 20182config:server.labels: { host: "logic-host-3" }
monitoring_servers:- host: 192.168.58.10
grafana_servers:- host: 192.168.58.10

附录:官方在线文档中,还部署了TiFlash,但是实际执行总是报错,因此在本配置文件中移除了TiFlash部署。

第三步:执行部署指令

在中控机执行以下指令:
tidb-test为集群名
v6.5.0为要安装的TiDB集群组件版本
--user root为部署机的ssh账号,需根据实际替换
./topo.yaml为集群拓扑配置
-p为执行交互,输入ssh账号密码

$ tiup cluster deploy tidb-test v6.5.0 ./topo.yaml --user root -p

第四步:启动TiDB集群

$ tiup cluster start tidb-test

第五步:查看TiDB集群情况

# 查看集群信息,包括集群名、版本、安装用户等
$ tiup cluster list
tiup is checking updates for component cluster ...
Starting component `cluster`: /root/.tiup/components/cluster/v1.11.3/tiup-cluster list
Name       User     Version  Path                                         PrivateKey
----       ----     -------  ----                                            ----------
tidb-test  root v6.5.0   /root/.tiup/storage/cluster/clusters/tidb-test  /root/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa
# 查看集群下节点状态等信息
$ tiup cluster display tidb-test
tiup is checking updates for component cluster ...
Starting component `cluster`: /root/.tiup/components/cluster/v1.11.3/tiup-cluster display tidb-test
Cluster type:       tidb
Cluster name:       tidb-test
Cluster version:    v6.5.0
Deploy user:        root
SSH type:           builtin
Dashboard URL:      http://192.168.58.10:2379/dashboard
Grafana URL:        http://192.168.58.10:3000
ID                 Role        Host         Ports        OS/Arch       Status   Data Dir                            Deploy Dir
--                 ----        ----         -----        -------       ------   --------                            ----------
192.168.58.10:3000   grafana     192.168.58.10  3000         linux/x86_64  Up       -                                   /tidb-deploy/grafana-3000
192.168.58.10:2379   pd          192.168.58.10  2379/2380    linux/x86_64  Up|L|UI  /tidb-data/pd-2379                  /tidb-deploy/pd-2379
192.168.58.10:9090   prometheus  192.168.58.10  9090/12020   linux/x86_64  Up       /tidb-data/prometheus-9090          /tidb-deploy/prometheus-9090
192.168.58.10:4000   tidb        192.168.58.10  4000/10080   linux/x86_64  Up       -                                   /tidb-deploy/tidb-4000
192.168.58.10:20160  tikv        192.168.58.10  20160/20180  linux/x86_64  Up       /tidb-data/tikv-20160               /tidb-deploy/tikv-20160
192.168.58.10:20161  tikv        192.168.58.10  20161/20181  linux/x86_64  Up       /tidb-data/tikv-20161               /tidb-deploy/tikv-20161
192.168.58.10:20162  tikv        192.168.58.10  20162/20182  linux/x86_64  Up       /tidb-data/tikv-20162               /tidb-deploy/tikv-20162
Total nodes: 8

第六步: 使用TiDB

方式一:使用navicat按照mysql的连接方式192.168.57.10:4000端口即可
方式二:访问http://192.168.58.10:2379/dashboard访问监控面板

参考材料
PingCAP使用TiUP部署

相关内容

热门资讯

【NI Multisim 14...   目录 序言 一、工具栏 🍊1.“标准”工具栏 🍊 2.视图工具...
银河麒麟V10SP1高级服务器... 银河麒麟高级服务器操作系统简介: 银河麒麟高级服务器操作系统V10是针对企业级关键业务...
不能访问光猫的的管理页面 光猫是现代家庭宽带网络的重要组成部分,它可以提供高速稳定的网络连接。但是,有时候我们会遇到不能访问光...
AWSECS:访问外部网络时出... 如果您在AWS ECS中部署了应用程序,并且该应用程序需要访问外部网络,但是无法正常访问,可能是因为...
Android|无法访问或保存... 这个问题可能是由于权限设置不正确导致的。您需要在应用程序清单文件中添加以下代码来请求适当的权限:此外...
北信源内网安全管理卸载 北信源内网安全管理是一款网络安全管理软件,主要用于保护内网安全。在日常使用过程中,卸载该软件是一种常...
AWSElasticBeans... 在Dockerfile中手动配置nginx反向代理。例如,在Dockerfile中添加以下代码:FR...
AsusVivobook无法开... 首先,我们可以尝试重置BIOS(Basic Input/Output System)来解决这个问题。...
ASM贪吃蛇游戏-解决错误的问... 要解决ASM贪吃蛇游戏中的错误问题,你可以按照以下步骤进行:首先,确定错误的具体表现和问题所在。在贪...
月入8000+的steam搬砖... 大家好,我是阿阳 今天要给大家介绍的是 steam 游戏搬砖项目,目前...