TiDB簡介
TiDB
是PingCAP
公司自主設(shè)計(jì)、研發(fā)的開源分布式關(guān)系型數(shù)據(jù)庫,同時(shí)支持在線事務(wù)處理與在線分析處理 (Hybrid Transactional and Analytical Processing, HTAP) 的融合型分布式數(shù)據(jù)庫產(chǎn)品,具備水平擴(kuò)容或者縮容、金融級(jí)高可用、實(shí)時(shí) HTAP、云原生的分布式數(shù)據(jù)庫、兼容 MySQL 5.7 協(xié)議和 MySQL 生態(tài)等重要特性。
TIDB安裝部署
TiDB
是一個(gè)分布式系統(tǒng)。最基礎(chǔ)的TiDB
測(cè)試集群通常由 2 個(gè)TiDB
實(shí)例、3 個(gè)TiKV
實(shí)例、3 個(gè)PD
實(shí)例和可選的TiFlash
實(shí)例構(gòu)成。
本文只是為了驗(yàn)證JeecgBoot
與TiDB
的兼容性,所以使用TiUP Playground
在單機(jī)搭建了一套測(cè)試集群。若用于生產(chǎn)環(huán)境部署,請(qǐng)參閱TiDB
官方文檔。
- 1、下載并安裝 TiUP。
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
安裝完成后提示:
Successfully set mirror to https://tiup-mirrors.pingcap.com
Detected shell: zsh
Shell profile: /Users/user/.zshrc
/Users/user/.zshrc has been modified to add tiup to PATH
open a new terminal or source /Users/user/.zshrc to use it
Installed path: /Users/user/.tiup/bin/tiup
===============================================
Have a try: tiup playground
===============================================
- 2、聲明全局環(huán)境變量。
source ${your_shell_profile}
- 3、在當(dāng)前 session 執(zhí)行以下命令啟動(dòng)集群。
執(zhí)行 tiup playground 命令會(huì)運(yùn)行最新版本的 TiDB 集群,其中 TiDB、TiKV、PD 和 TiFlash 實(shí)例各 1 個(gè)
tiup playground
運(yùn)行結(jié)果將顯示集群的訪問方式:
CLUSTER START SUCCESSFULLY, Enjoy it ^-^
To connect TiDB: mysql --comments --host 127.0.0.1 --port 4000 -u root -p (no password)
To view the dashboard: http://127.0.0.1:2379/dashboard
PD client endpoints: [127.0.0.1:2379 127.0.0.1:2382 127.0.0.1:2384]
To view the Prometheus: http://127.0.0.1:9090
To view the Grafana: http://127.0.0.1:3000
- 4、使用
Navicat
訪問TiDB
JeecgBoot集成TiDB
1、 初始化數(shù)據(jù)庫
- 1.1、復(fù)制一份
db/jeecgboot-mysql-5.7.sql
文件。 - 1.2、打開復(fù)制的sql文件,將
sys_tenant
表work_place
字段的字節(jié)碼由utf32
為utf8mb4
。
* 1.3、保存并在數(shù)據(jù)庫中執(zhí)行修改后的sql文件。
如果需要將現(xiàn)有的支持
Mysql
協(xié)議的數(shù)據(jù)遷移到TiDB
,可以使用TiDB官方提供的TIDB Data Migration
工具。具體使用方法請(qǐng)參閱TiDB官方文檔。
2、修改JeecgBoot配置文件
修改配置文件中的數(shù)據(jù)庫連接信息
3、啟動(dòng)項(xiàng)目
打印以下配置代表項(xiàng)目啟動(dòng)成功。文章來源:http://www.zghlxwxcb.cn/news/detail-820256.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-820256.html
到了這里,關(guān)于JeecgBoot集成TiDB,打造高效可靠的數(shù)據(jù)存儲(chǔ)解決方案的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!