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

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 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months 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)

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

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.

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

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

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())

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.

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

How does Go WebSocket integrate with databases? How does Go WebSocket integrate with databases? Jun 05, 2024 pm 03:18 PM

How to integrate GoWebSocket with a database: Set up a database connection: Use the database/sql package to connect to the database. Store WebSocket messages to the database: Use the INSERT statement to insert the message into the database. Retrieve WebSocket messages from the database: Use the SELECT statement to retrieve messages from the database.

See all articles