Design a 100% availability service architecture-applicable to any system (B/S, C/S) [Chinese and English versions]
Design a 100% availability service architecture-applicable to any system (B/S, C/S) [Chinese and English versions]
-- How to design an architecture which have 100 percent availability service?
All rights reserved. For more information, see http://blog.csdn.net/yangzhenping. thank you!
If you need to design and deploy this architecture, please trust me. Thank you!
Recently I have been thinking about how to design a 100% availability service, so I came up with the original version:
For example, there are multiple backup web servers and database servers, and A synchronization server synchronizes the data in master database A to other copies from the server
Question:
When Database Server A has not been synchronized to database Server B by DBSync Server, database Server A is down and part of the data may be lost.
So how can we avoid data loss?
As abve graph, there are some backup web servers and database servers, also have one sync server to sync data from master database server A to other slave database servers.
Then problem comes:
We may lost some data when some data in dbs a didn't sync toDBS B and it is outage!
How can we NOT to lose any data?
According to the problems encountered in the above design, I have designed the following architecture. Of course, this architecture can be improved. I will end with this article:
Based on above problem, I design another architecture like below, of course we can improve it again, talk it at the end of this article:
Web server A submits an SQL Script Request (including requestId, which is A Guid type) to the master database server, the DbSync Service of A synchronizes the SQL script request to the replica server B, then executes the SQL script on server A, and finally returns the result to Web server.
Similarly, when the database server receives A request from A, the SQL script is synchronized to the next copy server C, then, the execution result is returned to the comparative server (all the DBSync services on the replica server will return the result to the RCS ).
The server compares the results of the master database server and the results of the replica server based on the same requestId:
If the master DBS is successfully executed and the copy fails, the RCS re-runs on the copy until the copy is successful.
If the master DBS fails to be executed, the replica also fails, and the RCS will not do anything.
If the execution of the master DBS fails and the replica is successfully executed, we have two options:
Option 1: the RCS is re-executed on the primary DBS until the execution is successful. Then, the user is notified that the previous failed task submitted has succeeded.
Option 2: roll back the successful SQL script on the replica server and do not do anything on the primary DBS.
Web Server A request a SQL script (Contains requestId, it isa Guid type) to Master dbs a, in dbs a its sync service will sync the SQLscript to Slave B, then dbs a's Sync service will do the SQL script and thenreturn the result to Web Server.
Also dbs B's sync service receive the SQL script will syncthe SQL script to the next Slave DB server C, then execute the SQL script andreturnResult Compare Server(Allslave DB server's DB sync service will return the resultResult Compare Server).
Result Compare Server will compare the result usingrequestId, compare the Mater's requestId result to Slave's requestId result:
If Master execute pass, but Slave execute failure, RCS willrerun until pass on Slave.
If Master execute fail, and Slave execute failure, RC willdop nothing on Slave.
If Master execute fail, but Slave execute pass,
Option 1, RCS will rerun on Master until pass and notifyuser about this request pass when it pass.
Option 2, RCS will roll back the SQL script action on Slave, and do nothing on Master.
At the end of the article, by the way, this service can continue to be upgraded to a service with higher availability, that is, to build a backup server for the RCS.
This article mainly provides a 100% availability architecture for web servers and database servers. Of course, you can also apply it to the C/S architecture.
At the end of this article, you can improve it to be a better service, that's deploy another RCS backup server.
This article provide a way to deploy 100% high availability web server and database server, of course, you can also use it in C/S, not only B/S, thanks.
All rights reserved. For more information, see the source.Http://blog.csdn.net/yangzhenpingThank you!