Skip to content

Commit e888f3e

Browse files
committed
Upsun Fixed: mariadb replication
1 parent 13dc4b5 commit e888f3e

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

sites/platform/src/add-services/mysql/_index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Their infrastructure setup is nearly identical, though they differ in some featu
1111
See the [MariaDB documentation](https://mariadb.org/documentation/)
1212
or the Oracle [MySQL Server documentation](https://dev.mysql.com/doc/refman/en/) for more information.
1313

14+
{{% note theme="info" title="MariaDB note" %}}
15+
The [example](#mariadb-example) provided later in this topic is specific to using only a **primary** MariaDB database. For details about using read-only replicas to improve performance of read-heavy applications, see the [MariaDB read-only replication](/add-services/mysql/mysql-readonly-replication.md) topic.
16+
{{% /note %}}
17+
18+
1419
## Use a framework
1520

1621
If you use one of the following frameworks, follow its guide:
@@ -178,6 +183,10 @@ With the above definition, the application container now has [access to the serv
178183

179184
### MariaDB example
180185

186+
{{% note theme="info" %}}
187+
Use the steps and sample code below if your application will connect to a **primary** MariaDB database. For details about using read-only replicas to improve performance of read-heavy applications, see the [MariaDB read-only replication](/add-services/mysql/mysql-readonly-replication.md) topic.
188+
{{% /note %}}
189+
181190
#### [Service definition](/add-services/_index.md)
182191

183192
```yaml {configFile="services"}

sites/platform/src/add-services/mysql/mysql-readonly-replication.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,47 @@
11
---
2-
title: "MariaDB/MySQL read-only replication"
3-
sidebarTitle: "Read-only replication"
4-
description: Configure and access read-only MariaDB/MySQL replicas to ease the load on a primary database.
2+
title: "MariaDB read-only replication"
3+
sidebarTitle: "MariaDB read-only replication"
4+
description: Configure and access read-only MariaDB replicas to ease the load on a primary database.
55
---
66

7-
You can improve the performance of read-heavy applications by defining read-only replicas of your MariaDB/MySQL database and then connecting your application to those replicas.
7+
You can improve the performance of read-heavy applications by defining read-only replicas of your MariaDB database and then connecting your application to those replicas.
88

99
Examples of read-heavy applications include:
1010
- Listing pages or dashboards
1111
- Reporting or analytics jobs
1212
- Background jobs that frequently query data
1313

14+
{{< note theme="info" title="Note" >}}
15+
- **To prevent data loss or interruptions** during replication, you must configure the disk size for each replica. The replica service does not inherit the disk size of the primary database. The replica disk size must at least match the primary service's disk capacity. See the example below.
16+
- **Replication is asynchronous**: Delays of a few milliseconds might occur between writes on the primary database and reads on the replica database.
17+
- **Replicas are read-only**: This restriction ensures data consistency and integrity. Attempts to modify data will result in an SQL error.
18+
{{< /note >}}
19+
20+
### Read-only vs. external replicas
21+
Read-only replicas are used primarily to improve application performance by distributing database read requests from read-heavy applications.
22+
1423
Other common use cases for read-only replicas include:
1524
- Cross-region backup: Replicating data to different geographical regions
1625
- Data warehousing: Extracting data from production to analytics projects
1726

18-
**Note:** Read-only replicas are used primarily to improve application performance by distributing database read requests from read-heavy applications.
19-
20-
[External replicas](/add-services/mysql/mysql-replication.md) have different use cases, including disaster recovery.
27+
[External replicas](/add-services/mysql/mysql-replication.md) reside on remote servers and have different use cases, including disaster recovery.
2128

2229
### Replica scope and sharing services {#replica-scope-sharing-services}
23-
MariaDB/MySQL services (which provide access to databases and replicas) defined in a project cannot be accessed by or shared with applications in other projects.
30+
MariaDB services (which provide access to databases and replicas) defined in a project cannot be accessed by or shared with applications in other projects.
2431

25-
To share the MariaDB/MySQL service (databases and replicas) among applications in different projects, you must complete the following high-level steps:
26-
1. Migrate the projects to {{% vendor/company_name %}} Flex.
32+
To share the MariaDB service among applications in different projects, you must complete the following high-level steps:
33+
1. Migrate the {{% vendor/name %}} projects to {{% vendor/company_name %}} Flex.
2734
1. Migrate the applications that are in those projects.
28-
1. Include the desired applications in one Flex project, rather than individual Flex projects. In {{% vendor/company_name %}} Flex, multiple applications in one project can share the same services.
35+
1. Move the desired applications into one Flex project, rather than separate Flex projects. In {{% vendor/company_name %}} Flex, multiple applications in one project can share the same services.
2936

30-
{{< note theme="info" title="Important" >}}
31-
- **To prevent data loss or interruptions** during replication, you must configure the disk size for each replica. The replica service does not inherit the disk size of the primary database. The replica disk size must at least match the primary service's disk capacity. See the example below.
32-
- **Replication is asynchronous**: Delays of a few milliseconds might occur between writes on the primary database and reads on the replica database.
33-
- **Replicas are read-only**: This restriction ensures data consistency and integrity. Attempts to modify data will result in an SQL error.
34-
{{< /note >}}
37+
For details, see [Converting from {{% vendor/name %}}](https://docs.upsun.com/learn/tutorials/migrating/from-fixed.html) in the {{% vendor/company_name %}} Flex product docs.
3538

3639
## 1. Configure the primary and replica services
3740

3841
The following code fragment defines two MariaDB services: a primary and a replica. You can use this fragment as a template by copying it into your `services.yaml` or `application.yaml` file.
3942

4043
Be sure to:
41-
- Replace `<VERSION>` with the [supported PostgreSQL version](/add-services/mysql/_index.md#supported-versions) that you need. Use the same version number for the primary and replica services.
44+
- Replace `<VERSION>` with the [supported MariaDB version](/add-services/mysql/_index.md#supported-versions) that you need. Use the same version number for the primary and replica services.
4245
- Replace `<SIZE>` with a `disk` size in (MB) that is sufficient for the primary database's disk capacity.
4346
- **Important:** Use `replicator` as the endpoint name when you define the replica service. This is a special endpoint name that the replica service uses to connect to the database.
4447

0 commit comments

Comments
 (0)