数据库分库分表以及主从方案 (适合初创小公司方案)

本文介绍了初创公司适用的数据库分库分表和主从方案,以提高数据库性能和可用性。通过MySQL主从同步实现数据一致性和高可用,利用MyCat进行读写分离和分库分表,结合haproxy与keepalived实现负载均衡和故障转移,确保系统的稳定运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

reference:https://cloud.tencent.com/developer/article/1405270

Here, in this article, the writer tell us it’s better to divide the database and table in order to make sure each volume of database/table is not so huge.

And also, to make sure the read/write performance of the table is relatively good, we need to add slave database to synchronously replicate the master database, and then write to the master, read from the slave.

When we write/or to the database/table, we need to use unique id to mod how many machine we get, to write to the exact database.

For the global unique id, we can use snowflake algorithm referred in the article.

The big picture like this:

在这里插入图片描述

注意:要搭建高可用的架构,少不了要进行集群,但是所有的集群都需要一个入口,不能总是在一个集群上又搭建一个入口,那么这个入口又成为单点故障了。
因此解决不断单点故障的方案:在上层使用集群内的心跳机制,去中心化,在外面搭建一个VIP(虚拟IP,指向集群内的不同haproxy)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值