MyCAT learning summary, mycat Summary
MyCAT Introduction
Simply put, MyCAT is:
A thoroughly open-source"Large Database Cluster"
SupportedTransactions,ACID(Refers to the abbreviation of the four basic elements for correct execution of database transactions. Includes: Atomicity, Consistency, Isolation, Durability )),Can replace MysqlEnhanced version of the database
An enterprise-level database that can be regarded as a "Mysql" cluster to replace expensive Oracle Clusters
A new SQL Server that integrates memory cache technology, Nosql technology, and HDFS Big Data
A new-generation enterprise-level database product combining traditional databases and New Distributed Data Warehouses
A novel database middleware Product
The goal of MyCAT is:Low-cost migration of existing standalone databases and applications to the "Cloud" End solves the data bottleneck problem in the case of rapid growth of data storage and business scale.
Key features of MyCAT
Supports SQL 92 standards
Mysql clusters are supported and can be used as proxies.
Supports JDBC connection to ORACLE, DB2, and SQL Server, and simulates it as MySQL Server
Supports galera for mysql clusters, percona-cluster or mariadb cluster, and provides highly available data sharding clusters.
Automatic failover and high availability
Supports read/write splitting, Mysql dual-master multi-slave, and one-master multi-slave mode.
Supports Global tables. Data is automatically partitioned to multiple nodes for efficient table join queries.
Supports a unique sharding policy based on the E-R relationship to achieve efficient table join query.
Multi-platform support, simple deployment and implementation
MyCAT Architecture
Problems solved by Mycat
L performance problems
L too many database connections
L E-R fragment hard to handle
L availability problems
L cost and scalability
Sharding Policy
MyCAT supports horizontal and vertical parts:
Horizontal sharding: data in a table is divided into multiple nodes and separated by rows.
Vertical sharding: Multiple tables A, B, C, and A in A database are stored on node 1, B is stored on node 2, and C is stored on node 3.
MyCAT implements sharding by defining table sharding rules. Each table can bind a sharding rule. Each sharding rule specifies a sharding field and binds a function to implement a dynamic sharding algorithm.
1,Schema: Logical Database, which corresponds to the Database in MySQL. A logical Database defines the Table contained.
2,Table: A table, that is, a table stored in a physical database. Unlike a traditional database, the table here needs to declare the Logical Data Node DataNode it stores.You can specify the table sharding rules here.
3,DataNode: The Logical Data Node of MyCAT is a physical node that stores tables, also known as a shard node. it is associated to a specific backend database through DataSource.
4,DataSource: Defines the access address of a physical database for bundling to Datanode.
Mycat read/write splitting
Database read/write splitting is an essential feature for large systems or Internet applications with high traffic volumes. For MySQL, the standard read/write splitting mode is the Master-slave mode. A write node Master is followed by multiple read nodes. The number of read nodes depends on the system pressure. It is usually configured with 1-3 read nodes.
The master-slave replication mechanism of mysql is required for Mycat read/write splitting and automatic failover.
Master-slave replication of Mysql
Precautions for master-slave Configuration
1. the versions of the master DB server and slave DB server are consistent.
2. The data in the master DB server is consistent with that in the slave DB server database [here, the master backup can be restored from the top, you can also directly copy the data directory of the master node to the corresponding data directory.]
3. Enable binary logs for the primary DB server. Both the primary DB server and the slave DB server must have unique server_id