TheRobotLearns Platform · ProxySQL: from first install to production

Automation Patterns for Cluster Health, Sync Checks, and Endpoint Data

  • about 20 min read

Learning objectives

  • Align `admin-cluster_check_interval_ms` and `admin-cluster_check_status_frequency` with metric and backend intervals.
  • Run TSDB and cluster status queries after configuration changes or node joins.
  • Verify sync by comparing checksum tables, runtime values, and peer metrics after LOAD or SAVE.
  • Explain how HTTP, clustering, and admin connections relate to MySQL worker traffic when exposing endpoints.

Why a node join may not spread

You insert 10.0.0.5 and port 6032 into proxysql_servers on an active Core node. Core nodes are the primary nodes that keep and send the source of truth. The source of truth is the versioned, most recent configuration. You run LOAD PROXYSQL SERVERS TO RUNTIME, and that LOAD raises the version number that signals a new source of truth. Other nodes may still not pull it.

The cluster uses a pull-based sync path. Each node periodically compares configuration checksums with its peers. A mismatch tells a node that a module changed. Before pulling, the node waits for consistent mismatches defined by diffs_before_sync. For the node list itself, propagation assumes admin-cluster_proxysql_servers_diffs_before_sync has been met. Once the threshold is reached, the local node reads the remote peer's runtime_ tables. That fetched data is loaded into local memory and activated. If configured, the node also saves it to local disk.

You can verify the join from stats_proxysql_servers_checksums, which lists known peers with their versions and checksums.

Takeaway: A join needs an INSERT, a LOAD PROXYSQL SERVERS TO RUNTIME, and enough checksum mismatches to trigger a pull.

Aligning interval and status checks

You change admin-cluster_check_interval_ms away from its 1000 default. The change needs activation, because cluster variables belong to the Admin variables group.

admin-cluster_check_interval_ms defines how often, in milliseconds, the cluster module compares configuration checksums with its peers. admin-cluster_check_status_frequency defines after how many checksum checks a detailed status check runs. That detailed status check is SHOW MYSQL STATUS on peers. admin-cluster_check_status_frequency defaults to 10, and admin-cluster_check_interval_ms defaults to 1000.

admin-cluster_proxysql_servers_diffs_before_sync is the node-list threshold. It gives the number of consecutive checksum mismatches that ProxySQL counts before pulling the node list. A nonzero threshold waits; disabling a checksum gate forces that module's runtime diff threshold to 0. The default for this node-list threshold is 3.

For MySQL servers, admin-cluster_mysql_servers_sync_algorithm defaults to 1, synchronizing runtime server state and mysql_servers_v2. Changing that algorithm resets cluster checksums so the selected source is evaluated immediately.

After editing these values, you run LOAD ADMIN VARIABLES TO RUNTIME to move them into Runtime. You run SAVE ADMIN VARIABLES TO DISK to persist them.

Takeaway: Interval spacing comes from admin-cluster_check_interval_ms, peer status count from admin-cluster_check_status_frequency, and Admin variable loads activate both.

Reading checksums, metrics, and local versions

You run LOAD PROXYSQL SERVERS TO RUNTIME on a Core node after a node join. You can check peer visibility in the stats schema. The synchronized modules include Admin variables, MySQL variables, MySQL servers, MySQL users, query rules, and the ProxySQL servers list.

stats_proxysql_servers_checksums lists known peers with their versions and checksums. stats_proxysql_servers_metrics returns uptime, queries, and latency for other nodes. runtime_checksums_values gives the local node's current configuration versions.

A LOAD ... TO RUNTIME command on a Core node raises that node's version number. The higher version signals a new source of truth. Each node checks peer checksums at the interval set by admin-cluster_check_interval_ms. If admin-cluster__save_to_disk is enabled, ProxySQL automatically runs a SAVE ... TO DISK after it fetches and loads a new configuration from a peer.

Query stats_proxysql_servers_checksums, then query runtime_checksums_values. The checksum table covers known peers, and the runtime table covers the local node. Query stats_proxysql_servers_metrics for peer uptime, queries, and latency.

Takeaway: Compare stats_proxysql_servers_checksums for peers, runtime_checksums_values for local versions, and stats_proxysql_servers_metrics for peer metrics.

Separating endpoint paths from MySQL traffic

You open the Admin interface, or you reach the built-in HTTP web UI, while your MySQL client connections keep running. The Admin thread and MySQL Workers are separate thread types.

The Admin thread sets up the admin interface, reads configuration, serves the HTTP web UI, prepares clustering, and accepts admin connections. The built-in HTTP Server uses libmicrohttpd. MySQL Workers handle MySQL client and backend traffic. Multiple workers listen on the same port, and one specific worker thread is bound to each client connection for its lifetime.

ProxySQL runs one Cluster Thread for each ProxySQL cluster node, and the thread count scales dynamically as nodes are added or removed. Satellite nodes fetch configuration from Core nodes, so the cluster path is separate from the MySQL worker path even though the same daemon serves both.

MySQL worker threads consume the most CPU resources. Monitor module threads may expand significantly when hundreds or thousands of backend servers are managed.

Takeaway: Admin thread handles admin connections and the HTTP web UI, MySQL Workers handle MySQL traffic, and Cluster Threads scale one per node.

Add a node and inspect peer sync

INSERT INTO proxysql_servers (hostname, port) VALUES ('10.0.0.5', 6032);
LOAD PROXYSQL SERVERS TO RUNTIME;
SAVE PROXYSQL SERVERS TO DISK;

SELECT * FROM stats_proxysql_servers_checksums;
SELECT * FROM stats_proxysql_servers_metrics;
SELECT * FROM runtime_checksums_values;

The INSERT adds the new Core node details to proxysql_servers. LOAD PROXYSQL SERVERS TO RUNTIME activates the node list. SAVE PROXYSQL SERVERS TO DISK persists the activated node list. The first SELECT returns known peer versions and checksums. The second SELECT returns peer uptime, queries, and latency. The third SELECT returns the local node's current configuration versions.

Try it: config_layer_sim

Change admin-cluster_check_interval_ms and admin-cluster_check_status_frequency. Run LOAD ADMIN VARIABLES TO RUNTIME to move the changes into Runtime. Add 10.0.0.5 and port 6032 to proxysql_servers, run LOAD PROXYSQL SERVERS TO RUNTIME, then query stats_proxysql_servers_checksums. The query lists known peers with their versions and checksums.

Sources

Do more with an account

Automation Patterns for Cluster Health, Sync Checks, and Endpoint Data — ProxySQL: from first install to production