Automatic Member Fencing with OFFLINE_MODE in MySQL Group Replication
The article explains how MySQL Group Replication handles unintended member exits, introduces the OFFLINE_MODE option added in 8.0.18, and shows how DBAs can configure and query the system to maintain high availability during failures.
MySQL Group Replication enhances database high‑availability by keeping the service running even when a single server fails, provided that not all or a majority of members are down.
Members may unintentionally leave the group in several situations, such as after apply or recovery errors, when a majority cannot be reached (group_replication_unreachable_majority_timeout ≠ 0), when another member suspects a timeout, during sync‑group errors, after a failed primary election, or when automatic rejoining is enabled but unsuccessful.
The action taken after a member leaves is controlled by the group_replication_exit_state_action variable. Up to MySQL 8.0.17 the possible values were:
READ_ONLY – disables write operations on the server (default).
ABORT_SERVER – shuts the server down.
MySQL 8.0.18 introduced a new value, OFFLINE_MODE , which closes all connections and prevents users with CONNECTION_ADMIN or SUPER privileges from establishing new ones. This mode also includes the READ_ONLY effect; otherwise privileged users could still make non‑replicated changes.
DBAs can therefore tailor the failure‑handling behavior to keep the overall system operational, even in extreme cases where all members become unreachable due to network issues.
If the DBA configures READ_ONLY , only writes are blocked; with OFFLINE_MODE all operations are blocked; and with ABORT_SERVER the server is stopped completely.
When group_replication_exit_state_action=OFFLINE_MODE is set, a server that fails will appear with an ERROR state in the performance_schema.replication_group_members table. Example query:
SELECT * FROM performance_schema.replication_group_members;The offline mode status can be checked with:
SELECT @@GLOBAL.offline_mode;After resolving the fault, the DBA should re‑enable normal operation:
SET @@GLOBAL.offline_mode = OFF;In conclusion, the new OFFLINE_MODE protection aims to improve system high‑availability configuration, allowing developers to focus on application logic.
Community Announcements
The article also includes promotional information about free Mycat diagnostics, a call for technical content submissions on MySQL, DBLE, and DTLE topics, and contact details for the community.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.