To solve the problem of complex balancing, MySql officially launched the MySqlCluster architecture, the following describes the feasibility of five MySql server clusters in terms of basic conditions, costs, advantages and disadvantages, and application scenarios. 1. MySQLClusteri server load balancer solution
To solve the problem of complex balancing, MySql officially launched the MySql Cluster Architecture, the following describes the feasibility of five MySql server clusters in terms of basic conditions, costs, advantages and disadvantages, and application scenarios:
1. MySQL Clustering (ndb-cluster stogare)
The high-reliability solution provided by MySQL in the form of storage engines is transaction-safe, real-time data replication, and can be used in scenarios requiring high reliability and load balancing. This solution requires at least three node servers to achieve better results.
Cost:
1) the node server has a large demand for RAM and is linearly proportional to the database size;
2) it is best to use a Gigabit Ethernet network;
3) You also need to use the expensive SCI card provided by doldolphin.
Advantages:
1) it can be used in server load balancer scenarios;
2) it can be used in scenarios with high reliability;
3) High Scalability;
4) Real database redundancy;
5) easy to maintain.
Disadvantages:
As the database grows, the demand for RAM becomes greater, so the cost is high;
Speed:
It is almost 10 times slower than a typical single server (no Gigabit Ethernet, no SCI card, and storage engine restrictions.
Application scenarios:
Redundancy, high reliability, and load balancing
2. MySQL/GFS-GNBD/HA (Active/Passive)
GFS is a transaction-safe file system. You can share data with a MySQL instance at the same time.
Cost:
1) the cost of up to n high-performance servers, one of which is activated and others are used as backup servers.
Advantages:
1) high reliability
2) some degree of redundancy
3) scaling based on high reliability
Disadvantages:
1) no server load balancer
2) no guaranteed redundancy
3) the write operation cannot be scaled.
Speed:
1) two times of a single server. The read operation is well supported.
Application scenarios:
1) read-only applications requiring high reliability
3. MySQL/DRBD/HA (Active/Passive)
DRBD can provide shared hard disks. DRBD can be set to transaction security. You can share data with a MySQL instance at the same time.
Cost:
1) the cost of up to n high-performance servers, one of which is activated, while the others are used as backup servers.
Advantages:
1) high reliability;
2) a certain degree of redundancy;
3) it is scalable in the name of high reliability.
Disadvantages:
1) no server load balancer
2) no guaranteed redundancy
3) No scalability in writing load
Speed:
1) reading and writing is equivalent to a separate server.
Application scenarios:
1) applications requiring high reliability and read operation-intensive
4. MySQL Write Master/Multiple MySQL Read Slaves (Active/Active)
Consider different read and write database connections. You can use one master server for write operations, and n slave servers for read operations.
Cost:
1) the cost of up to one high-performance write server and n read servers
Advantages:
1) high reliability of read operations;
2) load balancing of read operations;
3) read-only server load balancer is scalable.
Disadvantages:
1) high reliability without write operations;
2) load balancing without write operations;
3) No scalability in write operations;
Speed:
1) same as a separate server; better support for reading operations
Application scenarios:
1) Read-intensive applications that require high reliability and load balancing.
5. Standalone MySQL Servers (Functionally separated) (Active)
Multiple independent servers with separated functions do not have high reliability and load balancing capabilities. they have many obvious disadvantages and are not considered.
Summary:
The HA solution recommended on the official MySQL website is combined with DRBD (solution 3 in this article) and Replication (Solution 4 in this article ). In addition to Linux Heartbeat, we can also implement the Auto-failover function. in this case, we will find that the down time will be greatly reduced.
We can also see that although the above solution solves the cluster problem, there is still a problem with the load balancing between Mysql servers. below we will choose the officially recommended solution 4, with Barracuda security server load balancer, the system achieves a truly efficient and reliable large-scale application architecture.