You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/08/02 10:08:39 UTC
[GitHub] [shardingsphere] TeslaCN commented on a diff in pull request #19787: feat(blog): add new blogs
TeslaCN commented on code in PR #19787:
URL: https://github.com/apache/shardingsphere/pull/19787#discussion_r935367732
##########
docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md:
##########
@@ -0,0 +1,646 @@
++++
+title = "Create a Distributed Database with High Availability with Apache ShardingSphere"
+weight = 42
+chapter = true
++++
+
+## What is Database High Availability (HA)?
+Inthe digital age, modern business systems have to be highly available, reliable, and stable. As the cornerstone of the modern business system, databases are supposed to embrace high availability.
+
+HA allows databases to switch over services between primary and secondary databases and to automatically select `Master`, so it can pick the best node as the master when the previous one crashes.
+
+## MySQL High Availability
+There are plenty of MySQL high availability options, but each of them has its pros and cons. Below are several common high availability options:
+
+- [Orchestrator](https://github.com/openark/orchestrator) is a MySQL HA and replication topology management tool written in Go. Its advantage lies in its support for manual adjustment of primary-secondary topology, automatic failover, automatic or manual recovery of master nodes through the Web visual console. However, the program needs to be deployed separately, and also has a steep learning curve due to the complex configurations.
+
+- [MHA](https://www.percona.com/blog/2016/09/02/mha-quickstart-guide/) is another mature solution. It provides primary/secondary switching and failover capabilities. The good thing about it is that it can ensure the least data loss in the switching process while it can work with semi-synchronous and asynchronous replication frameworks. However, after MHA starts, only `Master` is monitored, and MHA doesn’t provide the load balancing feature for the read database.
+- [MGR](https://dev.mysql.com/doc/refman/8.0/en/group-replication.html) implements group replication based on the distributed Paxos protocol to ensure data consistency. It is an official HA component provided by MySQL and no extra deployment program is required. Instead, users only need to install MGR Plugin in each data source node. The tool features high consistency, high fault tolerance, high scalability, and high flexibility.
+
+## Apache ShardingSphere High Availability
+Apache ShardingSphere’s architecture actually separates storage from computing. The storage node represents the underlying database, such as MySQL, PostgreSQL, openGauss, etc., while compute node refers to [ShardingSphere-JDBC](https://shardingsphere.apache.org/document/current/en/quick-start/shardingsphere-jdbc-quick-start/) or [ShardingSphere-Proxy](https://shardingsphere.apache.org/document/current/en/quick-start/shardingsphere-proxy-quick-start/).
+
+Accordingly, the high availability solutions for storage nodes and compute nodes are different. For stateless compute nodes, while they need to perceive the changes in storage nodes, they also need to set up separate load balancers and have the capabilities of service discovery and request distribution. Stateful storage nodes need to be equipped with the capabilities of data synchronization, connection testing, electing a master node, and so on.
+
+Although ShardingSphere doesn’t provide a database with high availability, it can help users integrate database HA solutions such as primary-secondary switchover, faults discovery, traffic switching governance, and so on with the help of the database HA and through its capabilities of database discovery and dynamic perception.
+
+When combined with the primary-secondary flow control feature in distributed scenarios, ShardingSphere can provide better high availability read/write splitting solutions. **It will be easier to operate and manage ShardingSphere clusters if we use [DistSQL](https://opensource.com/article/21/9/distsql)’s dynamic high availability adjustment rules to get primary/secondary nodes' information.**
+
+## Best Practices
+Apache ShardingSphere adopts a plugin-oriented architecture, so all its enhanced capabilities can be used independently or together. Its high availability function is often used together with read/write splitting to distribute query requests to the slave databases according to the load balancing algorithm to ensure system HA, relieve primary database pressure, and improve business system throughput.
+
+Here, we take HA+read/write splitting configuration with ShardingSphere DistSQL RAL statements as an example.
+
+**One thing to point out here is that ShardingSphere HA implementation leans on its distributed governance capability.** Therefore, it can only be used under the cluster mode for the time being. Meanwhile, read/write splitting rules are revised in ShardingSphere 5.1.0. For details, please refer to the official documentation about [read/write splitting](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting/).
+
+> **Configuration**
+
+```
Review Comment:
```suggestion
```yaml
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org