Skip to content

Commit 4bb76cd

Browse files
committed
Change secondary to replica and use primary as an adjective consistently
1 parent 044d11d commit 4bb76cd

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

content/en/docs/tasks/run-application/run-replicated-stateful-application.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ weight: 30
1515

1616
This page shows how to run a replicated stateful application using a
1717
[StatefulSet](/docs/concepts/workloads/controllers/statefulset/) controller.
18-
The example is a MySQL single-primary topology with multiple secondaries running
18+
The example is a MySQL single-primary topology with multiple replicas running
1919
asynchronous replication.
2020

2121
{{< note >}}
@@ -69,9 +69,9 @@ kubectl apply -f https://k8s.io/examples/application/mysql/mysql-configmap.yaml
6969
```
7070

7171
This ConfigMap provides `my.cnf` overrides that let you independently control
72-
configuration on the MySQL primary and secondaries.
73-
In this case, you want the primary to be able to serve replication logs to secondaries
74-
and you want secondaries to reject any writes that don't come via replication.
72+
configuration on the primary MySQL server and replicas.
73+
In this case, you want the primary server to be able to serve replication logs to replicas
74+
and you want replicas to reject any writes that don't come via replication.
7575

7676
There's nothing special about the ConfigMap itself that causes different
7777
portions to apply to different Pods.
@@ -96,12 +96,12 @@ cluster and namespace.
9696

9797
The Client Service, called `mysql-read`, is a normal Service with its own
9898
cluster IP that distributes connections across all MySQL Pods that report
99-
being Ready. The set of potential endpoints includes the MySQL primary and all
100-
secondaries.
99+
being Ready. The set of potential endpoints includes the primary MySQL server and all
100+
replicas.
101101

102102
Note that only read queries can use the load-balanced Client Service.
103-
Because there is only one MySQL primary, clients should connect directly to the
104-
MySQL primary Pod (through its DNS entry within the Headless Service) to execute
103+
Because there is only one primary MySQL server, clients should connect directly to the
104+
primary MySQL Pod (through its DNS entry within the Headless Service) to execute
105105
writes.
106106

107107
### StatefulSet
@@ -168,32 +168,32 @@ controller into the domain of MySQL server IDs, which require the same
168168
properties.
169169

170170
The script in the `init-mysql` container also applies either `primary.cnf` or
171-
`secondary.cnf` from the ConfigMap by copying the contents into `conf.d`.
172-
Because the example topology consists of a single MySQL primary and any number of
173-
secondaries, the script simply assigns ordinal `0` to be the primary, and everyone
174-
else to be secondaries.
171+
`replica.cnf` from the ConfigMap by copying the contents into `conf.d`.
172+
Because the example topology consists of a single primary MySQL server and any number of
173+
replicas, the script simply assigns ordinal `0` to be the primary server, and everyone
174+
else to be replicas.
175175
Combined with the StatefulSet controller's
176176
[deployment order guarantee](/docs/concepts/workloads/controllers/statefulset/#deployment-and-scaling-guarantees/),
177-
this ensures the MySQL primary is Ready before creating secondaries, so they can begin
177+
this ensures the primary MySQL server is Ready before creating replicas, so they can begin
178178
replicating.
179179

180180
### Cloning existing data
181181

182-
In general, when a new Pod joins the set as a secondary, it must assume the MySQL
183-
primary might already have data on it. It also must assume that the replication
182+
In general, when a new Pod joins the set as a replica, it must assume the primary MySQL
183+
server might already have data on it. It also must assume that the replication
184184
logs might not go all the way back to the beginning of time.
185185
These conservative assumptions are the key to allow a running StatefulSet
186186
to scale up and down over time, rather than being fixed at its initial size.
187187

188188
The second Init Container, named `clone-mysql`, performs a clone operation on
189-
a secondary Pod the first time it starts up on an empty PersistentVolume.
189+
a replica Pod the first time it starts up on an empty PersistentVolume.
190190
That means it copies all existing data from another running Pod,
191-
so its local state is consistent enough to begin replicating from the primary.
191+
so its local state is consistent enough to begin replicating from the primary server.
192192

193193
MySQL itself does not provide a mechanism to do this, so the example uses a
194194
popular open-source tool called Percona XtraBackup.
195195
During the clone, the source MySQL server might suffer reduced performance.
196-
To minimize impact on the MySQL primary, the script instructs each Pod to clone
196+
To minimize impact on the primary MySQL server, the script instructs each Pod to clone
197197
from the Pod whose ordinal index is one lower.
198198
This works because the StatefulSet controller always ensures Pod `N` is
199199
Ready before starting Pod `N+1`.
@@ -206,15 +206,15 @@ server, and an `xtrabackup` container that acts as a
206206
[sidecar](https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns).
207207

208208
The `xtrabackup` sidecar looks at the cloned data files and determines if
209-
it's necessary to initialize MySQL replication on the secondary.
209+
it's necessary to initialize MySQL replication on the replica.
210210
If so, it waits for `mysqld` to be ready and then executes the
211211
`CHANGE MASTER TO` and `START SLAVE` commands with replication parameters
212212
extracted from the XtraBackup clone files.
213213

214-
Once a secondary begins replication, it remembers its MySQL primary and
214+
Once a replica begins replication, it remembers its primary MySQL server and
215215
reconnects automatically if the server restarts or the connection dies.
216-
Also, because secondaries look for the primary at its stable DNS name
217-
(`mysql-0.mysql`), they automatically find the primary even if it gets a new
216+
Also, because replicas look for the primary server at its stable DNS name
217+
(`mysql-0.mysql`), they automatically find the primary server even if it gets a new
218218
Pod IP due to being rescheduled.
219219

220220
Lastly, after starting replication, the `xtrabackup` container listens for
@@ -224,7 +224,7 @@ case the next Pod loses its PersistentVolumeClaim and needs to redo the clone.
224224

225225
## Sending client traffic
226226

227-
You can send test queries to the MySQL primary (hostname `mysql-0.mysql`)
227+
You can send test queries to the primary MySQL server (hostname `mysql-0.mysql`)
228228
by running a temporary container with the `mysql:5.7` image and running the
229229
`mysql` client binary.
230230

@@ -291,7 +291,7 @@ it running in another window so you can see the effects of the following steps.
291291

292292
## Simulating Pod and Node downtime
293293

294-
To demonstrate the increased availability of reading from the pool of secondaries
294+
To demonstrate the increased availability of reading from the pool of replicas
295295
instead of a single server, keep the `SELECT @@server_id` loop from above
296296
running while you force a Pod out of the Ready state.
297297

@@ -409,9 +409,9 @@ Now uncordon the Node to return it to a normal state:
409409
kubectl uncordon <node-name>
410410
```
411411

412-
## Scaling the number of secondaries
412+
## Scaling the number of replicas
413413

414-
With MySQL replication, you can scale your read query capacity by adding secondaries.
414+
With MySQL replication, you can scale your read query capacity by adding replicas.
415415
With StatefulSet, you can do this with a single command:
416416

417417
```shell

content/en/examples/application/mysql/mysql-configmap.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ data:
99
# Apply this config only on the primary.
1010
[mysqld]
1111
log-bin
12-
secondary.cnf: |
13-
# Apply this config only on secondaries.
12+
replica.cnf: |
13+
# Apply this config only on replicas.
1414
[mysqld]
1515
super-read-only
1616

content/en/examples/application/mysql/mysql-statefulset.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
if [[ $ordinal -eq 0 ]]; then
3232
cp /mnt/config-map/primary.cnf /mnt/conf.d/
3333
else
34-
cp /mnt/config-map/secondary.cnf /mnt/conf.d/
34+
cp /mnt/config-map/replica.cnf /mnt/conf.d/
3535
fi
3636
volumeMounts:
3737
- name: conf
@@ -108,7 +108,7 @@ spec:
108108
# Determine binlog position of cloned data, if any.
109109
if [[ -f xtrabackup_slave_info && "x$(<xtrabackup_slave_info)" != "x" ]]; then
110110
# XtraBackup already generated a partial "CHANGE MASTER TO" query
111-
# because we're cloning from an existing secondary. (Need to remove the tailing semicolon!)
111+
# because we're cloning from an existing replica. (Need to remove the tailing semicolon!)
112112
cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in
113113
# Ignore xtrabackup_binlog_info in this case (it's useless).
114114
rm -f xtrabackup_slave_info xtrabackup_binlog_info

0 commit comments

Comments
 (0)