Home Database Mysql Tutorial oneproxy中间件架构及注意事项

oneproxy中间件架构及注意事项

Jun 07, 2016 pm 02:56 PM
middleware distributed database Architecture Precautions

分布式数据库实现方案总体划分为两类: 一类是程序客户端实现,对一个已有的业务来说,会涉及过多的代码改动甚至是程序逻辑上的调整。 另一类是采用中间件proxy方案,前段代码改动小,通过proxy实现。 架构图如下: 650) this.width=650;" src="http://www.6

分布式数据库实现方案总体划分为两类:
一类是程序客户端实现,对一个已有的业务来说,会涉及过多的代码改动甚至是程序逻辑上的调整。
另一类是采用中间件proxy方案,前段代码改动小,通过proxy实现。

架构图如下:

wKiom1XRQuuzA2OPAAGFsXyjpW0885.jpg


---------------------------------------------------------------------------------------
这里总结一下JAVA程序mybatis框架连接后的注意事项:
1、不支持 Server Side Cursor 接口,比如 MySQL C API 里的 Prepare、Bind、 Execute调用接口
2、不支持 use命令切换数据库
3、默认禁止 CALL, PREPARE, EXECUTE, DEALLOCATE 命令,也就是说不能用存储过程
3、单库(单实例)分表--insert/update/delete要加字段名,如insert into t1(id,name) values(1,'张三');
4、单库(单实例)分表--目前分了N张表,如果以自增id做关联查询,那么每张表的自增id都是从1开始,在与其他表join关联查询时,数据会不准确
5、单库(单实例)分表--当where条件有分区列时,值不能有函数转换,也不能有算术表达式,必须是原子值,否则结果不准确
6、分库分表(多实例)--不支持垮库join,例如user_0表在10.0.0.1机器里,现在要join关联查询10.0.0.2机器里的money_detail表,不支持
7、分库分表(多实例)--不支持分布式事务,例如user_0表在10.0.0.1机器里,user_1表在10.0.0.2机器里,现在想同时update更新两张表,不支持

---------------------------------------------------------------------------------------
8、读写分离 --默认读操作全部访问slave,如果想强制走主库,例如涉及金钱类的查询操作,SQL改为select /*master*/ from t1 where id=1;

9、分库分表/分表 --where条件带分区列时,直接命中该表,如果未带分区列,会逐一扫描所有分表(单线程),考虑性能问题,要加并行查询(多线程),SQL改为select /*parallel*/ from t1 where name='李四'; 并行查询会增加额外的CPU消耗
----------------------------------------------------------------------------------------
10、分表规则:支持range(范围),hash(取模),hash规则要提前规划好,具体分多少张表,如前期分64张表,1年后想扩容128张表,数据需要重新导出导入,成本非常高,目前二级分表还不支持。



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the architecture and working principle of Spring Data JPA? What is the architecture and working principle of Spring Data JPA? Apr 17, 2024 pm 02:48 PM

SpringDataJPA is based on the JPA architecture and interacts with the database through mapping, ORM and transaction management. Its repository provides CRUD operations, and derived queries simplify database access. Additionally, it uses lazy loading to only retrieve data when necessary, thus improving performance.

How steep is the learning curve of golang framework architecture? How steep is the learning curve of golang framework architecture? Jun 05, 2024 pm 06:59 PM

The learning curve of the Go framework architecture depends on familiarity with the Go language and back-end development and the complexity of the chosen framework: a good understanding of the basics of the Go language. It helps to have backend development experience. Frameworks that differ in complexity lead to differences in learning curves.

Hand-tearing Llama3 layer 1: Implementing llama3 from scratch Hand-tearing Llama3 layer 1: Implementing llama3 from scratch Jun 01, 2024 pm 05:45 PM

1. Architecture of Llama3 In this series of articles, we implement llama3 from scratch. The overall architecture of Llama3: Picture the model parameters of Llama3: Let's take a look at the actual values ​​of these parameters in the Llama3 model. Picture [1] Context window (context-window) When instantiating the LlaMa class, the variable max_seq_len defines context-window. There are other parameters in the class, but this parameter is most directly related to the transformer model. The max_seq_len here is 8K. Picture [2] Vocabulary-size and AttentionL

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Review! Comprehensively summarize the important role of basic models in promoting autonomous driving Review! Comprehensively summarize the important role of basic models in promoting autonomous driving Jun 11, 2024 pm 05:29 PM

Written above & the author’s personal understanding: Recently, with the development and breakthroughs of deep learning technology, large-scale foundation models (Foundation Models) have achieved significant results in the fields of natural language processing and computer vision. The application of basic models in autonomous driving also has great development prospects, which can improve the understanding and reasoning of scenarios. Through pre-training on rich language and visual data, the basic model can understand and interpret various elements in autonomous driving scenarios and perform reasoning, providing language and action commands for driving decision-making and planning. The base model can be data augmented with an understanding of the driving scenario to provide those rare feasible features in long-tail distributions that are unlikely to be encountered during routine driving and data collection.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

An in-depth analysis of how HTML reads the database An in-depth analysis of how HTML reads the database Apr 09, 2024 pm 12:36 PM

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

See all articles