Home Database Mysql Tutorial 数据库高可用架构(MySQL、Oracle、MongoDB、Redis)

数据库高可用架构(MySQL、Oracle、MongoDB、Redis)

Jun 07, 2016 pm 04:41 PM
mysql oracle Available database Architecture High availability

一、MySQL MySQL小型高可用架构 方案:MySQL双主、主从 + Keepalived主从自动切换 服务器资源:两台PC Server 优点:架构简单,节省资源 缺点:无法线性扩展,主从失败之后需要手动恢复主从架构 MySQL中型高可用架构 方案:MMM + MySQL双主 + 多从高可用方案

一、MySQL

MySQL小型高可用架构

方案:MySQL双主、主从 + Keepalived主从自动切换

服务器资源:两台PC Server

优点:架构简单,节省资源

缺点:无法线性扩展,主从失败之后需要手动恢复主从架构

MySQL中型高可用架构

方案:MMM + MySQL双主 + 多从高可用方案

服务器资源:

1、至少五台PC Server,2台MySQL主库,2台MySQL从库,1台MMM Monitor;

2、1台MMM Monitor选择低配;

3、如果不采用F5作为从库的负载均衡器,可用2台PC SERVER部署LVS或HAProxy+Keepalived组合来代替;

优点:双主热备模式,读写分离,SLAVE集群可线性扩展

缺点:读写分离需要在程序端解决,Master大批量写操作时会产生主从延时

MySQL大型高可用架构

主要思路:中间件+MySQL Sharding

如方案:Cobar等中间件+MySQL技术

图片略。

另外,还分享些MySQL一些主流的高可用架构

1、MySQL双主 + Keepalived主备自动切换方案(上面已有)

2、MySQL主从 + Keepalived主从自动切换方案(上面已有)

3、MMM+MySQL双主 + 多从高可用方案(上面已有)

4、MySQL + Pecemaker(Heartbeat) + DRBD高可用

5、MySQL + RHCS 高可用方案

6、MySQL + Cluser 集群架构

7、Percona Xtradb Cluster 集群高可用性解决方案

8、中间件 + MySQL 大型集群解决方案(上面已提到)

MySQL + Pecemaker(Heartbeat) + DRBD高可用 && MySQL + RHCS 高可用方案

Percona Xtradb Cluster 集群高可用性解决方案

MySQL多机房部署架构参考

二、Oracle

1、Oracle ActiveDataGuard

服务器资源:2台PC Server

1、Oracle自己的容灾系统,数据库完全冗余保护,可跨IDC部署;

2、Oracle 11g 以上版本Standby可Redo模式打开,可作为数据仓库使用,也可以作为备份数据库;

3、可切换,一般会采用手动切换方式。

2、Oracle RAC

服务器资源:至少两台PC Server作为RAC节点,SAN存储一台,

其他资源:光纤网络环境

RAC的特性:

1、高可用性:保证只要有一个存活的节点,就不会断业务,保持业务连续性

2、双机双工:RAC是并行模式工作的,节点间关系是Active对Active,每个节点都能为客户端提供服务

3、易伸缩:RAC的增加、删除节点非常方便

4、高吞吐量:节点数量和吞吐量是正比关系

3、Oracle MAA

方案:RAC+ASM+Standby(RAC)部署

服务器资源:RAC所需要资源*2

其他资源:异地机房

备注:MAA实质上就是RAC+DataGuard的结合体。

Oracle还有很多其他高可用架构,比如结合Oracle Golden Gate做复制等等……

三、MongoDB

MongoDB高可用架构

方案:MongoDB复制集+Sharding分片

服务器资源:

1、9台:6台PC Server作为shared节点,3台作为仲裁节点,三个Mongos和Config各部署在三个Shared节点上,如上图;

2、横向扩展分片,一组分片由3台PC Server构成;

3、仲裁节点服务器不存储实际数据,因此低配即可。

备注:

1、考虑到高可扩展问题,放弃MongoDB主从复制方案;

2、对数据安全要求非常高的业务,每组分片可由5台PC Server构成;

3、建议开发人员结合业务选出最合适的片键。

四、Redis

Redis小型高可用架构

方案:Redis主从复制+Keepalived实现Failover

服务器资源:两台PC Server

优点:架构简单,节省资源

缺点:主从切换有间隔,这期间客户端将收到错误

方案:Redis Sentinel实现Failover

服务器资源:

1、两台PC Server部署Redis,一台Redis Sentinel;

2、Redis可选择一主多从架构;

3、一台Redis Sentinel选择低配。

优点:Redis官方自带HA方案,Redis作者所编写,具备

缺点:发生Failover之后,客户端需要手动更正地址

Redis中型高可用架构

方案:Redis主从+Haproxy负载均衡

服务器资源:至少3台PC Server部署Redis主从,两台PC Server部署Haproxy

优点:读写分离,横向扩展Slave

缺点:Master为单点

Redis大型高可用架构

方案:Twemproxy实现Redis存储分片

服务器资源:至少6台PC Server部署Redis主从,至少3台PC Server部署Twemproxy,2台PC Server部署HAProxy

优点:分片,负载均衡,Redis和Twemproxy都可以横向扩展

缺点:Twemproxy所存在的缺点:

1、Twemproxy节点扩展,原来的数据需要重新处理分布,避免出现找不到key值;

2、扩展Redis节点,数据不会自动均匀分布,而需人工处理。

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

Solve database connection problem: a practical case of using minii/db library Solve database connection problem: a practical case of using minii/db library Apr 18, 2025 am 07:09 AM

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

See all articles