IceFireDB-SQLProxy #
A MySQL-protocol proxy that sits in front of ordinary MySQL servers and replays statements to the other agents in the mesh, so several MySQL instances in different places stay in step without changing the application.
cd IceFireDB-SQLProxy
make # → bin/IceFireDB-SQLProxy
./bin/IceFireDB-SQLProxy -c ./config/config.yaml
mysql -h 127.0.0.1 -P 33306 -u host1 -p # a user from userlist
What it is #
| Property | Value |
|---|---|
| Protocol | MySQL wire protocol |
| Backend | MySQL (mysql.admin, mysql.readonly) |
| Replication | Statements propagated between agents over libp2p |
| Listener | server.addr, default :33306 |
| Binary | bin/IceFireDB-SQLProxy (-c <config.yaml>) |
Configuration (config/config.yaml)
#
| Key | Meaning | Default in file |
|---|---|---|
server.addr | Proxy listener | ":33306" |
debug.enable / .port | Debug/pprof server | true / 17878 |
mysql.admin | Write connection pool: addr, user, password, dbname, minAlive, maxAlive, maxIdle | 127.0.0.1:3306, admin_user |
mysql.readonly | Read connection pool, same keys | 127.0.0.1:3306, readonly_user |
userlist | Client tenants (user/password) | host1 / host1 |
p2p.enable | Mesh replication | true |
p2p.serviceDiscoveryId | Rendezvous name, must match peers | tanovo_sqlproxy_admin_service |
p2p.serviceCommandTopic | Command channel | tanovo_sqlproxy_command_topic |
p2p.adminTopic / p2p.readonlyTopic | Per-role channels | tanovo_sqlproxy_admin_topic / …_readonly_topic |
p2p.serviceDiscoverMode | advertise or announce | advertise |
p2p.nodeHostIp / nodeHostPort | Address peers should dial | 127.0.0.1 / 0 |
Note the camelCase keys in this component (serviceDiscoveryId, not service_discovery_id as in
PubSub/SQLite). Copying a config between components silently gives you a default value.
Operational notes #
- Read/write separation is a config choice, not routing magic:
mysql.readonlyis the pool used for read queries,mysql.adminfor writes. Point them at the same server if you have no replica. - Sample credentials (
admin_pass,readonly_pass,host1/host1) are placeholders — replace them. - Statements replay to every agent, so deterministic SQL only.
NOW()/RAND()/UUID()can diverge. - No conflict resolution: the mesh is ordered by arrival, so two agents writing the same row concurrently converge on whichever statement applies last.
- The debug server is enabled in the sample config on port
17878; turn it off in production.
When to use it #
You already run MySQL and want the same data available closer to users in other regions without moving the application to a new database. It is not a MySQL cluster replacement: it does not do automatic failover of the MySQL backend, and it does not guarantee cross-site consistency for conflicting writes.