001 TiDB单机版安装

本教程详细介绍了如何使用TiUP Playground在本地搭建TiDB单机版测试环境,包括基础环境配置、安装TiUP、启动集群、访问数据库、监控界面及集群清理等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用 TiUP Playground 快速部署本地测试环境

注:本教程本地测试环境部署, 若单机模拟集群部署, 请参考: 使用 TiUP cluster 在单机上模拟生产环境部署步骤

基础环境配置

基础配置

  1. 安装yum源
    curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo yum install -y yum-utils device-mapper-persistent-data lvm2
    yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
    
  2. 安装必备工具
    yum install wget jq psmisc vim net-tools telnet yum-utils device-mapper-persistent-data lvm2 git -y
    
  3. 关闭firewalld 、dnsmasq、selinux
    systemctl disable --now firewalld 
    systemctl disable --now dnsmasq
    setenforce 0
    sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
    sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
    
下载并安装TiUP
[root@tidb-01 ~]# curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 7037k  100 7037k    0     0  4727k      0  0:00:01  0:00:01 --:--:-- 4732k
WARN: adding root certificate via internet: https://tiup-mirrors.pingcap.com/root.json
You can revoke this by remove /root/.tiup/bin/7b8e153f2e2d0928.root.json
Successfully set mirror to https://tiup-mirrors.pingcap.com
Detected shell: bash
Shell profile:  /root/.bash_profile
/root/.bash_profile has been modified to add tiup to PATH
open a new terminal or source /root/.bash_profile to use it
Installed path: /root/.tiup/bin/tiup
===============================================
Have a try:     tiup playground
===============================================
声明全局环境变量
[root@tidb-01 ~]# source .bash_profile

注:TiUP 安装完成会提示对应的 profile 文件的绝对路径,以下 source 操作需要根据实际位置进行操作

在当前 session 执行以下命令启动集群
[root@tidb-01 ~]# tiup playground

### 前台运行结果

The component `playground` version  is not installed
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值