Skip to content

Commit 19d9d0b

Browse files
djdefiCopilotlecoursen
authored
Fix unsafe redis-master pointer change in cluster primary node replacement (#62439)
Co-authored-by: Ryan Trauntvein <djdefi@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Laura Coursen <lecoursen@github.com> Copilot-Session: 64f6218c-01bc-4080-8d5b-f48dae1fe09d
1 parent 07ac18e commit 19d9d0b

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

content/admin/monitoring-and-managing-your-instance/configuring-clustering/replacing-a-cluster-node.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,38 @@ If you need to allocate more resources to your primary MySQL (or MySQL and MSSQL
207207
/usr/local/share/enterprise/ghe-mssql-repl-promote
208208
```
209209

210-
This will attempt to access the current primary MSSQL node and perform a graceful failover
210+
This will attempt to access the current primary MSSQL node and perform a graceful failover.
211+
212+
1. If the new node will also become the primary Redis node, confirm that the new node is a healthy, caught-up Redis replica before you continue. From any node in the cluster, run the following command.
213+
214+
```shell copy
215+
ghe-cluster-status-redis -v
216+
```
217+
218+
Confirm that the new node's entry reports `ok` and `Redis replication is in sync`, and that the current primary Redis node's entry also reports `ok`.
219+
220+
> [!WARNING]
221+
> Do not set `redis-master` to a node that is not a caught-up replica. If you do, the cluster can reconfigure the current primary Redis node as a replica of the new node and discard any data that hasn't replicated yet.
222+
223+
`ghe-cluster-status-redis` reports sync freshness, not exact replication offsets. Immediately before you edit `redis-master` in the next step, look up the current primary Redis node's hostname. Because `mysql-master` and `redis-master` are configured independently, the current primary Redis node isn't necessarily the database node you're replacing.
224+
225+
```shell copy
226+
ghe-config cluster.redis-master
227+
```
228+
229+
Then compare offsets directly, replacing `NEW-NODE-HOSTNAME` with the hostname of the new node and `CURRENT-REDIS-MASTER-HOSTNAME` with the value from the previous command. Check the new node first, then the current primary Redis node, so that a match reflects the primary's most recent state.
230+
231+
```shell copy
232+
ghe-redis-cli --remote -h NEW-NODE-HOSTNAME INFO replication
233+
ghe-redis-cli --remote -h CURRENT-REDIS-MASTER-HOSTNAME INFO replication
234+
```
235+
236+
Confirm that the new node's `slave_repl_offset` value matches the current primary Redis node's `master_repl_offset` value. If the values don't match, wait and check again. Do not continue until the offsets match.
211237

212238
1. After the GTIDs on the primary and replica MySQL nodes match, update the cluster configuration by opening the cluster configuration file at `/data/user/common/cluster.conf` in a text editor.
213239

214240
* Create a backup of the `cluster.conf` file before you edit the file.
215-
* In the top-level `[cluster]` section, remove the hostname for the node you replaced from the `mysql-master` key-value pair, then assign the new node instead. If the new node is also a primary Redis node, adjust the `redis-master` key-value pair.
241+
* In the top-level `[cluster]` section, remove the hostname for the node you replaced from the `mysql-master` key-value pair, then assign the new node instead. If the new node is also a primary Redis node, adjust the `redis-master` key-value pair only after the replication check in the previous step confirms the offsets match.
216242
* If {% data variables.product.prodname_actions %} is enabled in the cluster, you will have to include the `mssql-server = true` key-value pair as well.
217243

218244
<pre>
@@ -233,5 +259,14 @@ If you need to allocate more resources to your primary MySQL (or MySQL and MSSQL
233259
/usr/local/share/enterprise/ghe-repl-post-failover-mssql
234260
```
235261

262+
1. If you changed `redis-master`, confirm that the new primary Redis node is serving traffic and that the former primary Redis node has reconfigured as a healthy replica. Run the following commands.
263+
264+
```shell copy
265+
ghe-redis-cli PING
266+
ghe-cluster-status-redis -v
267+
```
268+
269+
Confirm that `ghe-redis-cli PING` returns `PONG` through the default HAProxy Redis endpoint, the new node's entry reports `ok`, and the former primary Redis node's entry reports `ok` and `Redis replication is in sync`.
270+
236271
1. Check the status of the MySQL(or MySQL and MSSQL) replication from any node in the cluster by running `ghe-cluster-status -v`.
237272
1. When the MySQL(or MySQL and MSSQL) replication is finished, from any node in the cluster, disable maintenance mode. See [AUTOTITLE](/admin/administering-your-instance/configuring-maintenance-mode/enabling-and-scheduling-maintenance-mode#enabling-or-disabling-maintenance-mode-for-all-nodes-in-a-cluster-via-the-cli).

0 commit comments

Comments
 (0)