This is the multi-page printable view of this section.
Tutorials
- 1: Build and start Mimus
- 2: Shared table across MySQL and PostgreSQL
- 3: Encrypt your first table with PG TDE
- 4: Two-node active-active lab with pgEdge
Start here when trying Mimus for the first time. Each tutorial walks through one runnable lab from start to finish and verifies the result with standard client tools.
- Build and start Mimus — Compile the PostgreSQL 19.0 kernel and
pg_mysqlfrom source, initializePGDATA, and inspectmimus_required_features. - Shared table across MySQL and PostgreSQL — Write rows on TCP
3306withmysqland read them back on TCP5432withpsql. - Encrypt your first table with PG TDE — Register a keyring provider, create a
USING tde_heaptable, and verify relation encryption. - Two-node active-active lab with pgEdge — Pair two writable nodes with Spock 5.0.15 and merge concurrent
delta_applybalance updates.
1 - Build and start Mimus
Prerequisites
You need a Linux host (Debian 13, Ubuntu 24.04/26.04, or Rocky Linux 9/10) with standard PostgreSQL build dependencies: a C11 compiler (gcc or clang), meson / ninja or GNU make, bison, flex, libreadline-dev, zlib1g-dev, libssl-dev, libicu-dev, libxml2-dev, and pkg-config.
Compile the kernel and pg_mysql
Clone the public pgsty/mimus kernel repository and the companion pgsty/pg_mysql extension repository, check out the verified 19.0.1-r4 revisions, and install under /usr/mimus-19:
To add pg_tde, spock or Babelfish onto the same /usr/mimus-19 prefix, build each extension against /usr/mimus-19/bin/pg_config using the matched source trees listed in Kernel Patch Manifest.
Initialize and verify the instance
Create a fresh data directory, start the server on port 5432, and inspect the version and cluster feature state:
On a freshly initialized cluster before any optional compatibility or encryption feature is activated, mimus_required_features returns an empty string, meaning the directory remains a plain PostgreSQL 19.0 data directory.
Next, continue to Shared table across MySQL and PostgreSQL to enable the MySQL wire listener on this instance.
2 - Shared table across MySQL and PostgreSQL
Preload pg_mysql
Starting from the instance created in Build and start Mimus, preload pg_mysql, enable the MySQL wire listener on port 3306, set a login password, and create the SQL extension inside postgres:
Ensure pg_hba.conf permits local TCP logins (scram-sha-256 or md5) from 127.0.0.1/32.
Create and populate a table from MySQL
Connect with the standard mysql command-line client on TCP 3306, create a logical MySQL database app, and insert two rows:
Each logical MySQL database maps to a PostgreSQL schema inside mysql.database (postgres by default).
Query the same physical table from PostgreSQL
Now read and join those exact committed rows over native PostgreSQL on port 5432:
Both sessions share one buffer pool, one WAL stream, and one physical relation (app.notes). For driver details, TLS setup and SQL dialect rules, see the MySQL manual.
3 - Encrypt your first table with PG TDE
Configure preloading and a local keyring
On an instance with pg_tde installed under /usr/mimus-19, add pg_tde to shared_preload_libraries, restart PostgreSQL, and register a local keyring file for your lab database:
Now enable the extension and bind a principal key in postgres:
File providers are intended for local testing and development. Production deployments should store principal keys in HashiCorp Vault or a KMIP server; see Keys and WAL encryption.
Create and verify an encrypted table
Create a table with USING tde_heap plus an index and out-of-line text, then confirm encryption status:
pg_tde_is_encrypted returns t. Primary heap pages, the primary-key B-tree index, and the TOAST table are all encrypted on disk while remaining transparent to SQL, MySQL (pg_mysql), and TDS (Babelfish) queries.
Check the cluster startup guard
Inspect the cluster’s recorded feature lock:
Once tde is recorded in mimus_required_features, Mimus refuses to start or replay WAL against this data directory if pg_tde is omitted from shared_preload_libraries, preventing accidental startup without storage decryption hooks. For backup and offline page verification, continue to the PG TDE manual.
4 - Two-node active-active lab with pgEdge
Initialize two writable nodes
With Spock 5.0.15 installed under /usr/mimus-19, initialize two local instances on ports 5541 (node_a) and 5542 (node_b) with logical WAL and commit timestamps enabled:
Create nodes, tables, and bidirectional subscriptions
Create the same table with delta_apply enabled on both nodes, register each Spock node, and wire up subscriptions in both directions:
Then add the reverse subscription on node_a (5541) with synchronize_data := false:
Verify concurrent delta updates
Apply independent balance adjustments on each node (+30 on node_a, -15 on node_b) and verify that both converge to 115:
For production conflict arbitration, monitoring, and standby failover rules, consult the pgEdge manual.