You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: maxscale/mariadb-maxscale-tutorials/automatic-failover-with-mariadb-monitor.md
+90-84Lines changed: 90 additions & 84 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,18 @@
1
1
# Automatic Failover With MariaDB Monitor
2
2
3
-
The [MariaDB Monitor](../reference/maxscale-monitors/mariadb-monitor.md) is not only capable of monitoring the state of a MariaDB primary-replica cluster but is also capable of performing _failover_ and _switchover_. In addition, in some circumstances it is capable of _rejoining_ a primary that has gone down and later reappears.
4
-
5
-
Note that the failover (and switchover and rejoin) functionality is only supported in conjunction with GTID-based replication and initially only for simple topologies, that is, 1 primary and several replicas.
6
-
7
-
The failover, switchover and rejoin functionality are inherent parts of the _MariaDB Monitor_, but neither automatic failover nor automatic rejoin are enabled by default.
8
-
9
-
The following examples have been written with the assumption that there are four servers - `server1`, `server2`, `server3` and `server4` - of which `server1` is the initial primary and the other servers are replicas. In addition there is a monitor called _TheMonitor_ that monitors those servers.
10
-
11
-
Somewhat simplified, the MaxScale configuration file would look like:
3
+
[MariaDB Monitor](../reference/maxscale-monitors/mariadb-monitor.md) can do more than just monitor
4
+
the state of a MariaDB replication cluster. The monitor can perform cluster manipulation operations
5
+
such as *failover*, *switchover* and *rejoin*. By default, these operations are launched manually,
6
+
but they can be configured to also trigger automatically. All replication modifying operations
7
+
assume GTID-based replication, and will refuse to launch or may work incorrectly when using
8
+
file-and-position-based replication. Also, the operations are mainly designed to work with simple
9
+
topologies, i.e. 1 primary and one to multiple replicas. More complicated setups (multilayered
10
+
replication, multimaster rings etc.) may work, but should be tested separately to ensure the results
11
+
are predictable.
12
+
13
+
The following examples have four servers: *server1* is the initial primary and *server2* to
14
+
*server4* are replicas. The servers are monitored by *TheMonitor*. The MaxScale configuration file
There are quite a few arguments, so let's look at each one separately_`call command` indicates that it is a module command that is to be_
280
-
\&#xNAN;_invoked,_`mariadbmon` indicates the module whose command we want to invoke,_`switchover` is the command we want to invoke, and_`TheMonitor` is the first argument to the command, the name of the monitor
281
-
as specified in the configuration file,_`server1` is the second argument to the command, the name of the server we_
282
-
\&#xNAN;_want to make into primary, and_`server2` is the third argument to the command, the name of the _currentprimary_.
275
+
The MaxCtrl command invocation is composed of the following parts:
276
+
1.`call command` launches a module command
277
+
2.`mariadbmon` is the module which implements the command
278
+
3.`switchover` is the command to invoke
279
+
4.`TheMonitor` specifies the target monitor
280
+
5.`server1` is the server to promote
281
+
6.`server2` is the server to demote, the current primary
283
282
284
-
If the command executes successfully, we will end up with the following
285
-
cluster state:
283
+
Specifying the current primary is optional. The name of the new primary server can also be left out
284
+
if autoselection is tolerable, leaving just `maxctrl call command mariadbmon switchover TheMonitor`.
285
+
As with *failover*, in MaxScale 25.10, the configured monitor name can be used as the module name:
286
+
`maxctrl call command TheMonitor switchover`.
287
+
288
+
If the switchover succeeds, we end up with the following cluster state:
0 commit comments