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)