课程名称:课程版本(201)+ 2.1 When to use TiDB platform(TiDB 的适用场景)& 2.2 How to connect TiDB platform(如何连接到 TiDB)
学习时长:
2 小时
课程收获:
2.1 When to use TiDB platform(TiDB 的适用场景)
2.2 How to connect TiDB platform(如何连接到 TiDB)
课程内容:
TiDB for OLTP-like workload
when you need Random,Real-time Read/Write access to your big data (billions of rows),with
- ACID compliance
- Secondary index support
- MySQL syntax
TiDB for Real-time HTAP workload
- Real-time HTAP (Hybrid transactional/analytical processing)
- When you have a OLTP-like workload using TiDB,and you want to perform OLAP query in place with the help of TiFlash
- with fresh data
- with zero interference on OLTP performance
- Data integration
- when you have multiple data sources like (OLTP databases,streaming ingestion and etc.),you want to perform OLAP query on the integrated data set
Connect with Spark Eco-system via TiSpark
Whith TiSpark you can use Spark to process data within TiDB platform inplace without moving your data out.
It’s useful when you want workload like:
- Iterative processing
- like traditional ETL job
- Joining datasets
- joining large datasets from multiple data sources
- a lot of shuffling and sorting is needed
When TiDB is not a good choice
- Your data can fit on a single server
- You need to perform heavy analytics tasks
- scanning and aggregation on large data sets,that intermediate results can not fit in single server’s memory
- You need sub-millisecond latency
- take a look at Redis?
TiDB speaks MySQL protocol
Client
- CLI
- offical mysql-client
- mycli
- GUI
- PHPMyAdmin
- MySQL Workbench
- Navicat
Driver
- Python
- mysqlclient
- PyMySQL
- MySQL-Python
- Java
- JDBC
Golang - go-sql-driver/mysql
- JDBC
Any programming language and its recommended MySQL connector
ORM (Object-Relational Mapping)
- Java
- Hibernate
- MyBatis
- Python
- Django ORM
- SQLAlchemy
- Go
- Gorm
- xorm
DEMO
- Use TiUP to lauch a local TiDB cluster for testing
- Use offical MySQL client to connect to TiDB
- Use PhpMyAdmin to connect to TiDB
- A Django + TiDB example
docker rm -f myadm_tidb
docker run -d \
--name myadm_tidb \
-e PMA_HOST=192.168.199.201 \
-e PMA_PORT="4000" \
-p 8080:80 \
phpmyadmin/phpmyadmin