【TiDB】TiDB离线方式部署
目录
1 下载TiDB离线组件包
2 安装TiUP
3 合并离线包
4 TIDB 软件和硬件环境建议配置
5 TiDB环境与系统配置检查
6 生成集群初始化配置文件模板
7 执行部署命令
1 检查就能存在的潜在风险
2 手动修复风险
3 部署 TiDB 集群
8 查看TIUP管理的集群情况
9 检查部署的 TiDB 集群情况
10 启动集群
参考 :
生产环境一般无法连接到外网环境 ,所以直接使用TiUP在线安装TiDB 的方式不太可取 。本篇博客介绍如何使用TiUP离线安装TiDB
下载地址
分布式数据库 TiDB 社区版 | PingCAP
1 下载TiDB离线组件包
wget https://download.pingcap.org/tidb-community-server-v6.5.5-linux-amd64.tar.gz
wget https://download.pingcap.org/tidb-community-toolkit-v6.5.5-linux-amd64.tar.gz
2 安装TiUP
将离线包发送到目标集群的中控机后,执行以下命令安装 TiUP 组件:
tar -zxvf tidb-community-server-v6.5.5-linux-amd64.tar.gz
cd tidb-community-server-v6.5.5-linux-amd64
sh local_install.sh # 脚本的内容大致为 :检查系统 ,架构 ,tar 命令是否存在 ,设置TiUP的环境变量 设置离线镜像等
执行成功之后输出以下内容:
设置离线镜像为 /home/software/tidb-community-server-v6.5.5-linux-amd64
生效环境变量 source /root/.bash_profile 或者 从新开一个终端
TiUP的可执行命令在目录下 /root/.tiup/bin/tiup
$ sh local_install.sh
Disable telemetry success
Successfully set mirror to /home/software/tidb-community-server-v6.5.5-linux-amd64
Detected shell: bash
Shell profile: /root/.bash_profile
/root/.bash_profile has been modified to to add tiup to PATH
open a new terminal or source /root/.bash_profile to use it
Installed path: /root/.tiup/bin/tiup
===============================================
1. source /root/.bash_profile
2. Have a try: tiup playground
===============================================
local_install.sh
脚本会自动执行 tiup mirror set tidb-community-server-${version}-linux-amd64
命令将当前镜像地址设置为 tidb-community-server-${version}-linux-amd64
。
若需将镜像切换到其他目录,可以通过手动执行 tiup mirror set <mirror-dir>
进行切换。如果需要切换到在线环境,可执行 tiup mirror set https://tiup-mirrors.pingcap.com
。
3 合并离线包
如果是通过官方下载页面下载的离线软件包,需要将 TiDB-community-server 软件包和 TiDB-community-toolkit 软件包合并到离线镜像中。执行以下命令合并离线组件到 server 目录下。
# 解压组件包
tar -xf tidb-community-toolkit-v6.5.5-linux-amd64.tar.gz# 查看目录
ls -ld tidb-community-server-v6.5.5-linux-amd64 tidb-community-toolkit-v6.5.5-linux-amd64cp -rp keys ~/.tiup/
# 合并镜像包
tiup mirror merge ../tidb-community-toolkit-v6.5.5-linux-amd64
$ tiup mirror show
/home/software/tidb-community-server-v6.5.5-linux-amd64$ which tiup
/root/.tiup/bin/tiup
4 TIDB 软件和硬件环境建议配置
TiDB 软件和硬件环境建议配置 | PingCAP 文档中心
5 TiDB环境与系统配置检查
TiDB 环境与系统配置检查 | PingCAP 文档中心
6 生成集群初始化配置文件模板
执行如下命令,生成集群初始化配置文件:
# 生成在执行命令的目录下 tiup cluster template > topology.yaml
7 执行部署命令
1 检查就能存在的潜在风险
tiup cluster check tidb.yaml
2 手动修复风险
检测出来的风险都可以通过官方文档找到解决方案
例如 报错
10.79.23.47 limits Fail soft limit of 'nofile' for user 'tidb' is not set or too low
10.79.23.47 limits Fail hard limit of 'nofile' for user 'tidb' is not set or too low
10.79.23.47 limits Fail soft limit of 'stack' for user 'tidb' is not set or too low
解决
cat << EOF >>/etc/security/limits.conf
tidb soft nofile 1000000
tidb hard nofile 1000000
tidb soft stack 32768
tidb hard stack 32768
EOF
当检查没有fail时,
3 部署 TiDB 集群
tiup cluster deploy tidb-test v6.5.5 tidb.yaml
以上部署示例中:
tidb-test
为部署的集群名称。v6.5.5
为部署的集群版本,可以通过执行tiup list tidb
来查看 TiUP 支持的最新可用版本。- 初始化配置文件为tidb
.yaml
。 --user root
表示通过 root 用户登录到目标主机完成集群部署,该用户需要有 ssh 到目标机器的权限,并且在目标机器有 sudo 权限。也可以用其他有 ssh 和 sudo 权限的用户完成部署。- [-i] 及 [-p] 为可选项,如果已经配置免密登录目标机,则不需填写。否则选择其一即可,[-i] 为可登录到目标机的 root 用户(或 --user 指定的其他用户)的私钥,也可使用 [-p] 交互式输入该用户的密码。
预期日志结尾输出 Deployed cluster `tidb-test` successfully
关键词,表示部署成功。
8 查看TIUP管理的集群情况
TiUP 支持管理多个 TiDB 集群,该命令会输出当前通过 TiUP cluster 管理的所有集群信息,包括集群名称、部署用户、版本、密钥信息等。
$ tiup cluster list
tiup is checking updates for component cluster ...
Starting component `cluster`: /root/.tiup/components/cluster/v1.13.0/tiup-cluster list
Name User Version Path PrivateKey
---- ---- ------- ---- ----------
tidb-test tidb v6.5.5 /root/.tiup/storage/cluster/clusters/tidb-test /root/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa
9 检查部署的 TiDB 集群情况
预期输出包括 tidb-test
集群中实例 ID、角色、主机、监听端口和状态(由于还未启动,所以状态为 Down/inactive)、目录信息。
$ tiup cluster display tidb-test
tiup is checking updates for component cluster ...
Starting component `cluster`: /root/.tiup/components/cluster/v1.13.0/tiup-cluster display tidb-test
Cluster type: tidb
Cluster name: tidb-test
Cluster version: v6.5.5
Deploy user: tidb
SSH type: builtin
Grafana URL: http://10.79.23.47:3001
ID Role Host Ports OS/Arch Status Data Dir Deploy Dir
-- ---- ---- ----- ------- ------ -------- ----------
10.79.23.47:9093 alertmanager 10.79.23.47 9093/9094 linux/x86_64 Down /home/storage/tidb_data/alertmanager-9093 /home/storage/tidb_deploy/alertmanager-9093
10.79.23.47:3001 grafana 10.79.23.47 3001 linux/x86_64 Down - /home/storage/tidb_deploy/grafana-3001
10.79.23.45:2379 pd 10.79.23.45 2379/2380 linux/x86_64 Down /home/storage/tidb_data/pd-2379 /home/storage/tidb_deploy/pd-2379
10.79.23.46:2379 pd 10.79.23.46 2379/2380 linux/x86_64 Down /home/storage/tidb_data/pd-2379 /home/storage/tidb_deploy/pd-2379
10.79.23.47:2379 pd 10.79.23.47 2379/2380 linux/x86_64 Down /home/storage/tidb_data/pd-2379 /home/storage/tidb_deploy/pd-2379
10.79.23.47:9090 prometheus 10.79.23.47 9090/12020 linux/x86_64 Down /home/storage/tidb_data/prometheus-9090 /home/storage/tidb_deploy/prometheus-9090
10.79.23.45:4000 tidb 10.79.23.45 4000/10080 linux/x86_64 Down - /home/storage/tidb_deploy/tidb-4000
10.79.23.46:4000 tidb 10.79.23.46 4000/10080 linux/x86_64 Down - /home/storage/tidb_deploy/tidb-4000
10.79.23.45:20160 tikv 10.79.23.45 20160/20180 linux/x86_64 N/A /home/storage/tidb_data/tikv-20160 /home/storage/tidb_deploy/tikv-20160
10.79.23.46:20160 tikv 10.79.23.46 20160/20180 linux/x86_64 N/A /home/storage/tidb_data/tikv-20160 /home/storage/tidb_deploy/tikv-20160
10.79.23.47:20160 tikv 10.79.23.47 20160/20180 linux/x86_64 N/A /home/storage/tidb_data/tikv-20160 /home/storage/tidb_deploy/tikv-20160
Total nodes: 11
10 启动集群
启动 tiup cluster start tidb-test
$ tiup cluster start tidb-test
tiup is checking updates for component cluster ...
Starting component `cluster`: /root/.tiup/components/cluster/v1.13.0/tiup-cluster start tidb-test
Starting cluster tidb-test...
+ [ Serial ] - SSHKeySet: privateKey=/root/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa, publicKey=/root/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.46
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.46
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.45
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.47
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.47
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.46
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.47
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.47
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.47
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.45
+ [Parallel] - UserSSH: user=tidb, host=10.79.23.45
+ [ Serial ] - StartCluster
Starting component pdStarting instance 10.79.23.47:2379Starting instance 10.79.23.46:2379Starting instance 10.79.23.45:2379Start instance 10.79.23.45:2379 successStart instance 10.79.23.47:2379 successStart instance 10.79.23.46:2379 success
Starting component tikvStarting instance 10.79.23.47:20160Starting instance 10.79.23.46:20160Starting instance 10.79.23.45:20160Start instance 10.79.23.47:20160 successStart instance 10.79.23.46:20160 successStart instance 10.79.23.45:20160 success
Starting component tidbStarting instance 10.79.23.46:4000Starting instance 10.79.23.45:4000Start instance 10.79.23.45:4000 successStart instance 10.79.23.46:4000 success
Starting component prometheusStarting instance 10.79.23.47:9090Start instance 10.79.23.47:9090 success
Starting component grafanaStarting instance 10.79.23.47:3001Start instance 10.79.23.47:3001 success
Starting component alertmanagerStarting instance 10.79.23.47:9093Start instance 10.79.23.47:9093 success
Starting component node_exporterStarting instance 10.79.23.45Starting instance 10.79.23.47Starting instance 10.79.23.46Start 10.79.23.45 successStart 10.79.23.47 successStart 10.79.23.46 success
Starting component blackbox_exporterStarting instance 10.79.23.47Starting instance 10.79.23.45Starting instance 10.79.23.46Start 10.79.23.45 successStart 10.79.23.47 successStart 10.79.23.46 success
+ [ Serial ] - UpdateTopology: cluster=tidb-test
Started cluster `tidb-test` successfully
停止
tiup cluster stop tidb-test
参考 :
使用 TiUP 离线部署 TiDB 集群 | PingCAP 文档中心
使用 TiUP 部署 TiDB 集群 | PingCAP 文档中心 (包含离线安装方式)
相关文章:

【TiDB】TiDB离线方式部署
目录 1 下载TiDB离线组件包 2 安装TiUP 3 合并离线包 4 TIDB 软件和硬件环境建议配置 5 TiDB环境与系统配置检查 6 生成集群初始化配置文件模板 7 执行部署命令 1 检查就能存在的潜在风险 2 手动修复风险 3 部署 TiDB 集群 8 查看TIUP管理的集群情况 9 检查部署的…...

android shape绘制半圆
<?xml version"1.0" encoding"utf-8"?><shape xmlns:android"http://schemas.android.com/apk/res/android"android:shape"rectangle"><sizeandroid:width"20dp"android:height"10dp" /><…...

【开源】基于Vue和SpringBoot的个人健康管理系统
项目编号: S 040 ,文末获取源码。 \color{red}{项目编号:S040,文末获取源码。} 项目编号:S040,文末获取源码。 目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 健康档案模块2.2 体检档案模块2.3 健…...
qt QString字符串常用转换
QString字符串转换类型,常见的有: 1. const char*初始化QString.即const char*类型转QString字符串类型. QString str("肖战");qDebug() <<str; 2. QChar数组初始化QString.即QChar字符数组转QString字符串. QChar cHello[5] {H,e,l,l,o};QString strHell…...
JAVA sql 查询3
-- 1. 求各个月入职的的员工个数 select date_format(hiredate,%m),count(date_format(hiredate,%m)) from employees group by date_format(hiredate,%m) -- 2. 查询 50 号部门,60 号部门,70 号部门的各个部门的平均工资 SELECT department_id,avg(salary) FROM employees WH…...
PHP while 和 do-while 循环 学习资料
PHP while 和 do-while 循环 在 PHP 中,while 和 do-while 是两种常用的循环结构,用于重复执行一段代码,直到满足指定条件为止。以下是对这两种循环的介绍和示例: while 循环 while 循环用于在指定条件为真时重复执行代码块。循…...
OpenJudge NOI 1.8 16:矩阵剪刀石头布 c语言
描述 Bart的妹妹Lisa在一个二维矩阵上创造了新的文明。矩阵上每个位置被三种生命形式之一占据:石头,剪刀,布。每天,上下左右相邻的不同生命形式将会发生战斗。在战斗中,石头永远胜剪刀,剪刀永远胜布&#…...
mysql 性能参数调优详解
1 优化连接池 连接池运行机制 MySQL连接器中的连接池,用以提高数据库密集型应用程序的性能和可扩展性,默认启用。MySQL连接器负责管理连接池中的多个连接,自动创建、打开、关闭和破坏连接,多个连接的创建,可满足多客户…...

基于.net framework4.0框架下winform项目实现寄宿式web api
首先Nuget中下载包:Microsoft.AspNet.WebApi.SelfHost,如下: 注意版本哦,最高版本只能4.0.30506能用。 1.配置路由 public static class WebApiConfig{public static void Register(this HttpSelfHostConfiguration config){// …...
Vue中项目进行文件压缩与解压缩 (接口返回文件的url压缩包前端解析并展示出来,保存的时候在压缩后放到接口入参进行保存)
安装 npm install pako在Vue组件中引入pako: import pako from pako;接口返回的url是这个字段 tableSsjsonUrl 其实打开就是压缩包const source await tableFileUrl ({ id: this.$route.query.id}); if(source.code 0) {this.titleName source.data.tableNam…...

Linux shell编程学习笔记31:alias 和 unalias 操作 命令别名
目录 0 前言1 定义别名2 查看别名 2.1 查看所有别名2.2 查看某个别名 2.2.1 alias 别名2.2.2 alias | grep 别名字符串2.2.3 使用 CtrlAltE 组合键3 unalias:删除别名4 如何执行命令本身而非别名 4.1 方法1:使用 CtrlAltE 组合键 && unalias4…...

Django JSONField/HStoreField SQL注入漏洞(CVE-2019-14234)
漏洞描述 Django 于2019年8月1日 日发布了安全更新,修复了 JSONField 和 HStoreField 两个模型字段的 SQL 注入漏洞。 参考链接: Django security releases issued: 2.2.4, 2.1.11 and 1.11.23 | Weblog | DjangoDjango JSONField SQL注入漏洞&#x…...

Unity中Shader的Standard材质解析(一)
文章目录 前言一、在Unity中,按一下步骤准备1、在资源管理面板创建一个 Standard Surface Shader2、因为Standard Surface Shader有很多缺点,所以我们把他转化为顶点片元着色器3、整理只保留主平行光的Shader效果4、精简后的最终代码 前言 在Unity中&am…...

5.1 Windows驱动开发:判断驱动加载状态
在驱动开发中我们有时需要得到驱动自身是否被加载成功的状态,这个功能看似没啥用实际上在某些特殊场景中还是需要的,如下代码实现了判断当前驱动是否加载成功,如果加载成功, 则输出该驱动的详细路径信息。 该功能实现的核心函数是NtQuerySys…...

Linux之高级IO
目录 IO基本概念五种IO模型钓鱼人例子五种IO模型高级IO重要概念同步通信 VS 异步通信阻塞 VS 非阻塞其他高级IO阻塞IO非阻塞IO IO基本概念 I/O(input/output)也就是输入和输出,在著名的冯诺依曼体系结构当中,将数据从输入设备拷贝…...

进程和线程的关系
⭐ 作者:小胡_不糊涂 🌱 作者主页:小胡_不糊涂的个人主页 📀 收录专栏:JavaEE 💖 持续更文,关注博主少走弯路,谢谢大家支持 💖 进程&线程 1. 什么是进程PCB 2. 什么是…...
YOLOv5全网独家改进:NanoDet算法动态标签分配策略(附原创改进代码),公开数据集mAP有效涨点,来打造新颖YOLOv5检测器
💡本篇内容:YOLOv5全网独家改进:NanoDet算法动态标签分配策略(附原创改进代码),公开数据集mAP有效涨点,来打造新颖YOLOv5检测器 💡🚀🚀🚀本博客 YOLOv5+ 改进NanoDet模型的动态标签分配策略源代码改进 💡一篇博客集成多种创新点改进:NanoDet 💡:重点:更…...

原生DOM事件、react16、17和Vue合成事件
目录 原生DOM事件 注册/绑定事件 DOM事件级别 DOM0:onclick传统注册: 唯一(同元素的(不)同事件会覆盖) 没有捕获和冒泡的,只有简单的事件绑定 DOM2:addEventListener监听注册:可添加多个…...

基于HTML+CSS+JavaScript的登录注册界面设计
一、界面效果: 二、HTML代码: 登录注册html: 登录成功html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <h1>登录成功!</h1> </body> <…...

BUUCTF [MRCTF2020]Ez_bypass 1
题目环境:F12查看源代码 I put something in F12 for you include flag.php; $flagMRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}; if(isset($_GET[gg])&&isset($_GET[id])) { $id$_GET[id]; $gg$_GET[gg]; if (md5($id) md5($gg) && $id ! $gg) { …...
反向工程与模型迁移:打造未来商品详情API的可持续创新体系
在电商行业蓬勃发展的当下,商品详情API作为连接电商平台与开发者、商家及用户的关键纽带,其重要性日益凸显。传统商品详情API主要聚焦于商品基本信息(如名称、价格、库存等)的获取与展示,已难以满足市场对个性化、智能…...
在鸿蒙HarmonyOS 5中实现抖音风格的点赞功能
下面我将详细介绍如何使用HarmonyOS SDK在HarmonyOS 5中实现类似抖音的点赞功能,包括动画效果、数据同步和交互优化。 1. 基础点赞功能实现 1.1 创建数据模型 // VideoModel.ets export class VideoModel {id: string "";title: string ""…...

全志A40i android7.1 调试信息打印串口由uart0改为uart3
一,概述 1. 目的 将调试信息打印串口由uart0改为uart3。 2. 版本信息 Uboot版本:2014.07; Kernel版本:Linux-3.10; 二,Uboot 1. sys_config.fex改动 使能uart3(TX:PH00 RX:PH01),并让boo…...

AirSim/Cosys-AirSim 游戏开发(四)外部固定位置监控相机
这个博客介绍了如何通过 settings.json 文件添加一个无人机外的 固定位置监控相机,因为在使用过程中发现 Airsim 对外部监控相机的描述模糊,而 Cosys-Airsim 在官方文档中没有提供外部监控相机设置,最后在源码示例中找到了,所以感…...
08. C#入门系列【类的基本概念】:开启编程世界的奇妙冒险
C#入门系列【类的基本概念】:开启编程世界的奇妙冒险 嘿,各位编程小白探险家!欢迎来到 C# 的奇幻大陆!今天咱们要深入探索这片大陆上至关重要的 “建筑”—— 类!别害怕,跟着我,保准让你轻松搞…...
Web中间件--tomcat学习
Web中间件–tomcat Java虚拟机详解 什么是JAVA虚拟机 Java虚拟机是一个抽象的计算机,它可以执行Java字节码。Java虚拟机是Java平台的一部分,Java平台由Java语言、Java API和Java虚拟机组成。Java虚拟机的主要作用是将Java字节码转换为机器代码&#x…...
uniapp 字符包含的相关方法
在uniapp中,如果你想检查一个字符串是否包含另一个子字符串,你可以使用JavaScript中的includes()方法或者indexOf()方法。这两种方法都可以达到目的,但它们在处理方式和返回值上有所不同。 使用includes()方法 includes()方法用于判断一个字…...
【SpringBoot自动化部署】
SpringBoot自动化部署方法 使用Jenkins进行持续集成与部署 Jenkins是最常用的自动化部署工具之一,能够实现代码拉取、构建、测试和部署的全流程自动化。 配置Jenkins任务时,需要添加Git仓库地址和凭证,设置构建触发器(如GitHub…...
当下AI智能硬件方案浅谈
背景: 现在大模型出来以后,打破了常规的机械式的对话,人机对话变得更聪明一点。 对话用到的技术主要是实时音视频,简称为RTC。下游硬件厂商一般都不会去自己开发音视频技术,开发自己的大模型。商用方案多见为字节、百…...

循环语句之while
While语句包括一个循环条件和一段代码块,只要条件为真,就不断 循环执行代码块。 1 2 3 while (条件) { 语句 ; } var i 0; while (i < 100) {console.log(i 当前为: i); i i 1; } 下面的例子是一个无限循环,因…...