Skip to content

Commit 93f7ad4

Browse files
Update MySQL switchover tests and docs to enable replica binlog before switchover (#15252) (#10845)
[upstream:46aff679746b8d179405de838bf3d469e5d2eb3d] Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent 96c2bfc commit 93f7ad4

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

google-beta/services/sql/resource_sql_database_instance_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4724,6 +4724,9 @@ resource "google_sql_database_instance" "original-replica" {
47244724
settings {
47254725
tier = "db-perf-optimized-N-2"
47264726
edition = "ENTERPRISE_PLUS"
4727+
backup_configuration {
4728+
binary_log_enabled = true
4729+
}
47274730
}
47284731
}
47294732
`, project, primaryName, project, replicaName)
@@ -4770,6 +4773,9 @@ resource "google_sql_database_instance" "original-replica" {
47704773
settings {
47714774
tier = "db-perf-optimized-N-2"
47724775
edition = "ENTERPRISE_PLUS"
4776+
backup_configuration {
4777+
binary_log_enabled = true
4778+
}
47734779
}
47744780
}
47754781
`, project, primaryName, drReplicaName, project, replicaName, primaryName)
@@ -4811,6 +4817,9 @@ resource "google_sql_database_instance" "original-replica" {
48114817
settings {
48124818
tier = "db-perf-optimized-N-2"
48134819
edition = "ENTERPRISE_PLUS"
4820+
backup_configuration {
4821+
binary_log_enabled = true
4822+
}
48144823
}
48154824
}
48164825
`, project, primaryName, project, replicaName, primaryName)

website/docs/guides/sql_instance_switchover.html.markdown

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ resource "google_sql_database_instance" "original-primary" {
101101

102102
## MySQL
103103

104-
1. Create a **cross-region, Enterprise Plus edition** primary and replica. The primary should have backup and binary log enabled.
104+
1. Create a **cross-region, Enterprise Plus edition** primary and replica. The primary should have backup and binary log enabled, and the replica should have binary log enabled.
105105

106106
```
107107
resource "google_sql_database_instance" "original-primary" {
@@ -140,6 +140,9 @@ resource "google_sql_database_instance" "original-replica" {
140140
# Any tier that supports Enterprise Plus edition.
141141
tier = "db-perf-optimized-N-2"
142142
edition = "ENTERPRISE_PLUS"
143+
backup_configuration {
144+
binary_log_enabled = true
145+
}
143146
}
144147
145148
# You can add more settings.
@@ -182,6 +185,9 @@ resource "google_sql_database_instance" "original-replica" {
182185
settings {
183186
tier = "db-perf-optimized-N-2"
184187
edition = "ENTERPRISE_PLUS"
188+
backup_configuration {
189+
binary_log_enabled = true
190+
}
185191
}
186192
}
187193
```
@@ -191,7 +197,7 @@ resource "google_sql_database_instance" "original-replica" {
191197
* Change `instance_type` from `READ_REPLICA_INSTANCE` to `CLOUD_SQL_INSTANCE`.
192198
* Remove `master_instance_name`.
193199
* Add original primary's name to the original replica's `replica_names` list and `replication_cluster.failover_dr_replica_name`.
194-
* Enable backup and binary log for original replica.
200+
* Enable backup for original replica.
195201

196202
```diff
197203
resource "google_sql_database_instance" "original-primary" {
@@ -232,10 +238,10 @@ resource "google_sql_database_instance" "original-replica" {
232238
settings {
233239
tier = "db-perf-optimized-N-2"
234240
edition = "ENTERPRISE_PLUS"
235-
+ backup_configuration {
241+
backup_configuration {
236242
+ enabled = true
237-
+ binary_log_enabled = true
238-
+ }
243+
binary_log_enabled = true
244+
}
239245
}
240246
}
241247
```

0 commit comments

Comments
 (0)