feat: rebuild shared MySQL platform - #4
Merged
Conversation
Replace the single-node database and Prometheus stack with a two-member InnoDB ReplicaSet, client-local Routers, off-host physical backups, and Zabbix. BREAKING CHANGE: direct MySQL service aliases and Prometheus-based monitoring are removed without a compatibility layer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Why
Changes
Architecture
mysql-shared01,mysql-shared02web01,workbench01,control01monitor01and Agent 2 on all hostsApplication databases and users are declared as tenants. Application repositories remain responsible for schema migrations.
MySQL ReplicaSet
mysql-shared02at10.10.10.222with a uniqueserver_id.log_replica_updates, relay recovery, TLS-required remote traffic, and seven-day binlog retention.mysql-shared01only as the initial bootstrap seed. Runtime status owns thePRIMARYandSECONDARYroles.site.ymlconvergence.MySQL Router
Router runs beside each client rather than on a central host. Bootstrap registers each Router in ReplicaSet metadata, stores the generated credential in its keyring, and reuses the generated TLS certificate and private key. Router binds only to loopback and UNIX sockets; Router-to-MySQL and metadata traffic requires TLS.
Read/write routing
127.0.0.1:6446and/run/mysqlrouter/mysql-rw.sockroute to the current primary.127.0.0.1:6447and/run/mysqlrouter/mysql-ro.sockprefer the current secondary and use Router's primary fallback when needed.127.0.0.1:6450and/run/mysqlrouter/mysql-rw-split.sockuse statement-aware read/write splitting with connection sharing.wait_for_my_writes=1with a one-second timeout. Workloads requiring cross-connection read-after-write guarantees must use the RW endpoint.Backup and restore
mysqld, runsSELECT 1, verifies expected databases, proves process ownership before shutdown, and cleans up.Zabbix migration
monitor01as Zabbix Server 7.0 LTS, frontend, and local PostgreSQL. Monitoring does not depend on the shared MySQL service.DNS model
Stable identities remain
mysql-shared01.srv.alflag.internalandmysql-shared02.srv.alflag.internal. Topology operations derive the operator aliases from fresh ReplicaSet status:mysql-shared-primary.srv.alflag.internalmysql-shared-replica.srv.alflag.internalThe aliases are not application routing endpoints. The updater validates and atomically writes the runtime fragment on both authoritative servers, handles SOA serial wrap using RFC 1982 ordering, requires matching serials and record hashes, reloads NSD, and records the successfully loaded state. Forced failover omits the replica alias while no healthy secondary exists.
Impact
Breaking changes
mysql-shared01may be rebuilt.mysql-shared02is newly introduced.blackbox_exporteris removed.node_exporteris removed.Validation
mise run checkpasses: 51 unit tests, seven playbook syntax checks, and production-profile YAML/Ansible lint with zero failures and zero warnings.ansible-inventory --graphresolves two MySQL nodes, the three Router clients, andmonitor01in the intended groups.node --checkpasses for the MySQL Shell program; all 22 repository Python files compile without generated bytecode.git diff --checkpasses.10.10.10.222and no device or VM named as a backup, NAS, or storage candidate.control01,workbench01,monitor01, both authoritative DNS servers, andmysql-shared01. The existingmysql-shared01reports MySQL8.4.10.force:<target>confirmation.Operational procedures
Current procedures and secret contracts are documented in
docs/mysql-platform.md. The explicit topology and data-safety operations are:Planned maintenance switches primary away from the node being serviced, applies targeted OS/MySQL maintenance, rejoins and catches up the node, then optionally switches primary back.
Limitations
mysql-shared02is unreachable withNo route to host, andweb01SSH times out.mysql_backup_repositorymount are supplied.RPO=0are not provided.