This is the multi-page printable view of this section.
How-to Guides
- 1: Instance profiles, ports and authentication
- 2: Backup, restore and encrypted recovery
- 3: Build extensions, run REPACK and validate workloads
- 4: Conflict resolution and standby failover
Use these task-oriented guides when planning deployments, configuring authentication, rehearsing backups, building extensions, or operating active-active clusters.
- Instance profiles, ports and authentication — Select your listener profile, assign non-colliding ports, and verify native and compatibility authentication.
- Backup, restore and encrypted recovery — Run physical backups, preserve historical encryption keys, restore DocumentDB archives, and stay within WAL limits.
- Build extensions, run REPACK and validate workloads — Compile C and Rust (
pgrx) modules against Mimuspg_config, reorganize encrypted tables safely, and test client SQL. - Conflict resolution and standby failover — Configure deterministic conflict rules, monitor Spock replication lag, and rehearse physical standby promotion.
1 - Instance profiles, ports and authentication
Select an instance profile
Every Mimus instance retains its native PostgreSQL listener (5432) for administration, backup, and native SQL clients. In addition, choose at most one session or document compatibility profile per PGDATA directory:
| Instance profile | shared_preload_libraries baseline | Client ports |
|---|---|---|
| Native PostgreSQL | (empty, or pg_tde, spock) | 5432 |
| MySQL compatible | pg_mysql (plus optional pg_tde, spock) | 5432, 3306 |
| MSSQL compatible | babelfishpg_tds (plus optional pg_tde, spock) | 5432, 1433 |
| MongoDB gateway | pg_cron, DocumentDB (single-node) | 5432, 27017 (gateway) |
Service gateways that require zero kernel patches (pgredis, pgetcd, pgsilo) connect over standard PostgreSQL pools and load their companion extensions (pg_redis, pg_etcd, or silo schemas) on stock or Mimus instances.
Plan default and co-located ports
When running multiple services or Pigsty infrastructure agents on the same host, check default port assignments before binding listeners:
| Protocol / Service | Protocol default | Common host note |
|---|---|---|
| PostgreSQL | 5432 | Native administration and SQL |
MySQL (pg_mysql) | 3306 | Configurable via mysql.port |
MSSQL (Babelfish) | 1433 | Configurable via babelfishpg_tds.port |
MongoDB (DocumentDB gateway) | 27017 | Standalone gateway listener |
Redis (pgredis) | 6379 | Gateway defaults to 127.0.0.1:56379 in local labs |
etcd (pgetcd) | 2379 / 2381 | Collides with host etcd DCS if Patroni runs locally |
S3 (pgsilo) | 9000 / 9001 | Shares default MinIO / Silo object and console ports |
Verify native and compatibility authentication
Before enabling compatibility extensions, verify native login, account identity, and build version using the psql binary from your Mimus installation:
Role access on port 5432 follows standard PostgreSQL 19 client authentication (pg_hba.conf, scram-sha-256, TLS). MySQL (3306) and TDS (1433) listeners negotiate their own wire handshakes (caching_sha2_password / mysql_native_password for MySQL; TDS login mappings for Babelfish), so always verify login separately through the target client driver after configuring native roles.
2 - Backup, restore and encrypted recovery
Run physical backups and offline page checks
Use pg_basebackup from the matching /usr/mimus-19/bin installation to take physical backups of Mimus clusters, including instances with pg_tde, spock, pg_mysql, or Babelfish enabled:
On encrypted clusters, physical pages on disk contain ciphertext. Standard checksum tools that are unaware of pg_tde cannot inspect encrypted page payloads directly; always use the Mimus toolchain built with layer 100 / 101 storage hooks and rehearse independent restore into a separate host before relying on a backup chain.
Guard historical keys alongside WAL
Rotating a principal key re-wraps internal relation keys, while historical WAL segments and older base backups still depend on earlier principal key versions during point-in-time recovery (PITR).
- Never delete or purge retired key versions from Vault, KMIP, or file keyrings while any physical backup or archived WAL referencing them remains within your retention window.
- Store your Mimus kernel revision, extension git trees, and
SHOW mimus_required_featuresoutput in your backup manifest. See Back up, restore and migrate for full runbooks.
Logical pg_restore for single-node DocumentDB
When restoring a pg_dump archive from a single-node DocumentDB instance into a fresh target, handle pg_cron background jobs with one of two verified procedures:
- Use fresh default jobs: Run
pg_restore -N cronto skip archivedcronrows and keep the target installation’s default jobs. - Preserve archived job history: Pause job scheduling on the clean target, run
CREATE EXTENSION documentdb CASCADEand unschedule its four newly created default jobs in one transaction, restore the full archive, and resume scheduling.
Observe encrypted-WAL replication boundaries
When cluster-wide WAL encryption (pg_tde.wal_encrypt = on) is enabled on 19.0.1-r4:
- Cascading physical replication (standby streaming to another downstream standby) is unsupported.
- Standby mid-segment restart: A physical standby that restarts and re-streams from the beginning of an encrypted WAL segment is excluded in
19.0.1-r4; provision fresh base backups or evaluate plaintext WAL over TLS links when standby restarts are routine. - MSSQL temporary objects: On Babelfish instances, T-SQL
#temptables,@tablevariables, and sort/hash workfiles use ordinaryheapstorage and can reach disk in plaintext; see Temporary storage and plaintext on disk.
3 - Build extensions, run REPACK and validate workloads
Choosing extension binaries
Build native C and Rust (pgrx 0.20.1) extensions using the pg_config binary and server headers from the target /usr/mimus-19 installation:
A shared PostgreSQL 19 major version establishes the SQL baseline, not universal drop-in ABI compatibility with prebuilt third-party binaries, because the unified Mimus kernel includes Babelfish parser/executor hooks alongside storage and replication interfaces. pgrx 0.20.1 header compatibility is verified against Mimus 19.0.1-r4 (790 PG 19 tests passed). For workloads requiring Citus or TimescaleDB, deploy a separate community PostgreSQL cluster.
Validating a workload
Before migrating an application, run an end-to-end check against your chosen listener and storage configuration:
- Exercise driver connection startup, TLS negotiation, authentication, and parameter binding.
- Run representative schema DDL, concurrent reads/writes, generated keys, null handling, and collation comparisons from both the compatibility protocol (
MySQL,MSSQL, orMongoDB) and nativepsql. - Take a backup, restore it into a second isolated instance, and re-run application smoke checks against the restored data. See 19.0.1-r4 Verification for tested combinations.
Storage and third-party extensions
Mimus excludes OrioleDB, Citus, and TimescaleDB (including when pg_tde is disabled).
For online or offline table reorganization on PostgreSQL 19, always use PostgreSQL 19’s built-in REPACK command rather than the external pg_repack extension. In verification testing, external pg_repack 1.5.3 rewrote tde_heap tables back into unencrypted ordinary heap storage while queries continued returning rows without warning. After any table rewrite, verify encryption on the relation, indexes, and TOAST table with pg_tde_is_encrypted(); see PG TDE table coverage.
4 - Conflict resolution and standby failover
Choose conflict arbitration rules
Asynchronous multi-master replication allows two nodes to commit writes to the same row before replicating to each other. Before adding a table to a spock replication set, configure track_commit_timestamp = on on every node and match each table column pattern to a deterministic conflict rule:
- Last-update-wins (
last_update_wins): Resolves concurrentINSERT/UPDATEconflicts using commit timestamps; Mimus kernel layers200/201preserve surviving subtransaction commit timestamps insideCOMMITWAL so physical standbys see identical timestamps. - Delta-apply (
spock.delta_apply): For numeric counters and balances, enablelog_old_value = trueanddelta_apply_function = spock.delta_applyon the column so concurrent increments and decrements commute cleanly. - Distributed IDs: Avoid colliding
SERIALsequences across writable nodes by assigning disjoint sequence ranges, UUIDs, or the pgEdge Snowflake extension.
Monitor subscriptions and conflict logs
Check subscription state, replication slot lag, and recorded conflict history on every writable node:
See pgEdge conflict operations for detailed diagnostics.
Rehearse physical standby promotion
When pairing Spock logical nodes with local physical HA standbys:
- Ensure every physical standby runs a Mimus kernel built through layer
201(or full401) so it can replay Spock’s customCOMMITWAL records generated during subtransaction conflict resolution; stock community PostgreSQL binaries cannot replay those records. - Synchronize logical replication slot positions (
sync_replication_slotsor controlled slot failover) and encryption key providers on standbys before rehearsing promotion; see pgEdge recovery boundaries.