Tidb集群加mysql_TiDB - 快速入门,集群搭建
TiDB 是開源分布式關系型數據庫,是一款同時支持在線事務處理與在線分析處理 (Hybrid Transactional and Analytical Processing, HTAP)的融合型分布式數據庫產品,具備水平擴容或者縮容、金融級高可用、實時 HTAP、云原生的分布式數據庫、兼容 MySQL 5.7 協議和 MySQL 生態等重要特性。目標是為用戶提供一站式 OLTP (Online Transactional Processing)、OLAP (Online Analytical Processing)、HTAP 解決方案。TiDB 適合高可用、強一致要求較高、數據規模較大等各種應用場景。
本文目標初步了解TiDB
使用TiUP在單機上模擬生產環境搭建TiDB集群步驟
基本使用
初步了解TiDBTiDB是 開源的 分布式的 關系型的 數據庫
TiDB兼容 MySQL 5.7 協議
TiDB具備水平擴容和縮容
使用TiUP在單機上模擬生產環境搭建TiDB集群步驟
1. TiUP是一個集群管理工具,推薦部署在中控機
2. 準備一臺部署主機,推薦安裝 CentOS 7.3 及以上版本。(可以和中控機在一起)
3. 下載并安裝 TiUPcurl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
## 重新聲明全局環境變量
source .bash_profile
## 確認 TiUP 工具是否安裝
which tiup
## 安裝 TiUP cluster 組件
tiup cluster
## 更新 TiUP cluster 組件至最新版本
tiup update --self && tiup update cluster
4. 新建一個配置文件 topology.yaml。ip改成需要部署的機器的ip,注意ssh端口提供一份topology.yaml模板:topology.yaml## Global variables are applied to all deployments and used as the default value of
## the deployments if a specific deployment value is missing.
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/data/tidb-deploy"
data_dir: "/data/tidb-data"
## Monitored variables are applied to all the machines.
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
server_configs:
tidb:
log.slow-threshold: 300
tikv:
readpool.storage.use-unified-pool: false
readpool.coprocessor.use-unified-pool: true
pd:
replication.enable-placement-rules: true
tiflash:
logger.level: "info"
pd_servers:
- host: 192.168.137.13
tidb_servers:
- host: 192.168.137.13
tikv_servers:
- host: 192.168.137.13
port: 20160
status_port: 20180
monitoring_servers:
- host: 192.168.137.13
5. 執行集群部署命令### 查看tidb版本列表
tiup list tidb
### tidb-test 為集群名稱,v4.0.4 當前安裝的版本
tiup cluster deploy tidb-test v4.0.4 ./topology.yaml --user root -p
### 按照引導,輸入”y”及 root 密碼,來完成部署
6. 啟動集群### tidb-test 為集群名稱
tiup cluster start tidb-test
7. 查看集群的拓撲結構和狀態tiup cluster display tidb-test
8. 訪問web監控后臺,默認賬號root,密碼空
http://192.168.137.13:2379/dashboard/#/signin
基本使用
1. 使用 Navicat Premium 15注冊版 連接數據庫,默認端口4000,賬號root,密碼空
2. 修改或設置密碼## set password for 賬號=password('新密碼');
set password for root=password('root');
總結
以上是生活随笔為你收集整理的Tidb集群加mysql_TiDB - 快速入门,集群搭建的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于git分支
- 下一篇: shell变量里的字符替换