Tidb实战部署[单节点部署][集群部署][Ansible集群部署]

本文详细介绍了如何进行TiDB的单节点部署和Ansible集群部署,包括环境准备、服务启动、密码修改、远程连接设置等步骤。在Ansible部署中,涉及了系统依赖安装、SSH互信、NTP服务、inventory.ini文件配置等内容,旨在提供一套完整的TiDB集群搭建方案。
摘要由CSDN通过智能技术生成

TIDB简介

TiDB 是 PingCAP 公司设计的开源分布式 HTAP (Hybrid Transactional and Analytical Processing) 数据库,结合了传统的 RDBMS 和 NoSQL 的最佳特性。TiDB 兼容 MySQL,支持无限的水平扩展,具备强一致性和高可用性。TiDB 的目标是为 OLTP (Online Transactional Processing) 和 OLAP (Online Analytical Processing) 场景提供一站式的解决方案。

官方链接:https://pingcap.com/docs-cn/v3.0/overview/


单节点部署

不建议单节点,开发环境使用.

一、下载官方源

[root@iZ31lo2i2a80qcZ /]# cd tmp/
[root@iZ31lo2i2a80qcZ tmp]# wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz
[root@iZ31lo2i2a80qcZ tmp]# wget http://download.pingcap.org/tidb-latest-linux-amd64.sha256
///验证文件完整性/
[root@iZ31lo2i2a80qcZ tmp]# sha256sum -c tidb-latest-linux-amd64.sha256
tidb-latest-linux-amd64.tar.gz: OK					#返回ok说明文件没问题
[root@iZ31lo2i2a80qcZ tmp]# tar -zxvf tidb-latest-linux-amd64.tar.gz
[root@iZ31lo2i2a80qcZ tmp]# mv tidb-latest-linux-amd64  /tidb-server
[root@iZ31lo2i2a80qcZ /]# cd tidb-server/

二、分别启动tidb、pd、tikv服务

[root@iZ31la80qcZ tidb-server]# ./bin/pd-server --data-dir=/data/pd --log-file=/data/logs/pd.log &
[root@iZ31la80qcZ tidb-server]# ps -ef|grep pd-server

root     11900 11812  0 14:12 pts/0    00:00:00 ./bin/pd-server --data-dir=/data/pd --log-file=/data/logs/pd.log
root     11916 11812  0 14:13 pts/0    00:00:00 grep --color=auto pd-server

[root@iZ31lo2i2a80qcZ tidb-server]# ./bin/tikv-server --pd="127.0.0.1:2379" --data-dir=/data/tikv --log-file=/data/logs/tikv.log &
[root@iZ31lo2i2a80qcZ tidb-server]#  ps -ef|grep tikv-server

root     11920 11812 10 14:14 pts/0    00:00:02 ./bin/tikv-server --pd=127.0.0.1:2379 --data-dir=/data/tikv --log-file=/data/logs/tikv.log
root     12021 11812  0 14:14 pts/0    00:00:00 grep --color=auto tikv-server

[root@iZ31lo2i2a80qcZ tidb-server]#  ./bin/tidb-server --store=tikv --path="127.0.0.1:2379" --log-file=/data/logs/tidb.log &
[root@iZ31lo2i2a80qcZ tidb-server]# ps -ef|grep tidb-server

root     12025 11812  1 14:15 pts/0    00:00:00 ./bin/tidb-server --store=tikv --path=127.0.0.1:2379 --log-file=/data/logs/tidb.log
root     12063 11812  0 14:16 pts/0    00:00:00 grep --color=auto tidb-server

三、修改登录密码,开启远程连接权限务

[root@iZ31lo2i2a80qcZ tidb-server]# 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 1
Server version: 5.7.25-TiDB-v4.0.0-alpha-1258-g8e88825f5 TiDB Server (Apache License 2.0), MySQL 5.7 compatible
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
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.
mysql> ALTER USER 'root'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.03 sec)
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

踩过的坑:单节点在数据库无连接时会自动关闭


Ansible集群部署

一、环境准备

<
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值