基于docker-compose搭建tiDB集群

1. 安装docker

CentOS7 安装docker

2. 安装docker-compose

Windows、Macos平台安装Docker时会自动安装Docker-compose,Linux不会

1. 用daocloud下载docker-compose

sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

2. 给文件添加可执行权限

sudo chmod +x /usr/local/bin/docker-compose

3. 测试安装结果

$ docker-compose --version
 
docker-compose version 1.16.1, build 1719ceb

3. 安装git

sudo yum install -y git

4. 下载 tidb-docker-compose

git clone https://github.com/pingcap/tidb-docker-compose.git

5. 进入该目录执行命令

cd tidb-docker-compose/

6. 获取最新的 docker 镜像文件

docker-compose pull 

Pulling pd0 … done
Pulling pd1 … done
Pulling pd2 … done
Pulling tikv0 … done
Pulling tikv1 … done
Pulling tikv2 … done
Pulling tidb … done
Pulling tispark-master … done
Pulling tispark-slave0 … done
Pulling tidb-vision … done
Pulling pushgateway … done
Pulling prometheus … done
Pulling grafana … done
Pulling dashboard-installer … done

7. 创建并启动集群

docker-compose up -d

8. 访问 tidb:密码为空

mysql -h 127.0.0.1 -P 4000 -u root

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.25-TiDB-v5.0.1 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

9. 修改密码

ALTER USER 'root'@'%' identified by '新密码';

10. 访问grafana

http://ip地址:3000

11. 访问集群可视化

http://ip地址:8010

12. 若TiDB启动失败,则先执行

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

龙域、白泽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值