Mycat sub-library sub-table of realization

Mycat sub-library sub-table of realization

Use the premise of sub-library sub-table:

When your database table data is particularly large, for example, hundreds of millions of records, and optimize database performance itself basically can not solve the problem, the root cause is the database itself io read and write to a bottleneck, this time, the need to store huge amounts of data and inquiries. At this point we need to use the idea of sub-library sub-table is to be optimized database architecture. With the rise of the micro-architecture of this service, we have a complete application from the application of large, cut into many small applications can provide services independently. Each application has its own database.

 

 

 What is Mycat?

A completely open source, enterprise-oriented application development "big database cluster."

Support for the transaction, ACID, can replace the enhanced version of Mysql database

· Enterprise-class database can be viewed as a "Mysql" Clusters, Oracle Clusterware used to replace expensive

· A fusion memory cache, Nosql technology, HDFS large new SQL Server data

· Combination of traditional database and data warehouse generation of new distributed enterprise-level database products

· A new database middleware products

Mycat architecture:

 

 

  

 

 Mycat key features:

Supports SQL 92 standard

Support Mysql cluster, can be used as a Proxy

Support for JDBC connection ORACLE, DB2, SQL Server, MySQL Server will use it to simulate

Support galera for mysql cluster, percona-cluster or mariadb cluster, providing high availability data fragmentation cluster

Automatic failover, high availability

Support separate read and write support Mysql from multiple double main, and a multi-master mode from

Support global table, the data to be fragmented plurality of nodes for efficient table associated with the query

Support partitioning strategy based on the unique relationship of ER, enables efficient table associated with the query

Multi-platform support, simple deployment and implementation

 

Mycat problems:

cross-database join issue

通过业务分析将不同库的join查询拆分成多个select

建立全局表(每个库都有一个相同的表)

冗余字段(不符合数据库三范式)

* E-R分片(将有关系的记录都存储到一个库中)

最多支持跨两张表跨库的join

l 分布式事务(弱事务)

强一致性事务(同步)

最终一致性事务(异步思想)

l 分布式主键

* redis incr命令

数据库(生成主键)

* UUID

* snowflake算法

Mycat的下载及安装

下载mycat:

github地址:https://github.com/MyCATApache

  Mycat安装:

安装rz上传文件工具

yum install -y lrzsz

第一步:把MyCat的压缩包上传到linux服务器

第二步:解压缩,得到mycat目录

tar -zxvf Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz

第三步:进入mycat/bin,启动MyCat

启动命令:./mycat start

停止命令:./mycat stop

重启命令:./mycat restart

 

注意:可以使用mysql的客户端直接连接mycat服务。默认服务端口为8066

Guess you like

Origin www.cnblogs.com/wnlsq/p/12141978.html