Topologies
One process or several, one PostgreSQL store or several, and what each arrangement survives.
Every deployment runs the same mimicd binary over PostgreSQL. What changes
from a laptop to a large deployment is how many processes serve it and how
many stores hold its data. Processes keep nothing of their own, so adding
or removing one moves no data.
One process, one store
export MIMIC_POSTGRES_URL='postgres://mimicd:PASSWORD@db.example:5432/mimic?sslmode=verify-full'
mimicd serve --bootstrap-admin admin --bootstrap-password-file /etc/mimicd/admin-passwordThe smallest deployment, and what the quickstart's Compose file runs. A process started without an internal listener runs alone: it holds every partition, and it refuses to start while processes with an internal listener are live on the same deployment.
| Lost | What happens |
|---|---|
| The process | The deployment is down until the supervisor restarts it. Nothing acknowledged is lost. |
| PostgreSQL's primary, with standby | PostgreSQL fails over; the process reconnects. A synchronous standby loses no acknowledged write |
| PostgreSQL, with no standby | The deployment is down until PostgreSQL is back; what PostgreSQL lost is lost |
Several processes, one store
Run any number of processes on the same store and deployment name, each with an internal listener and the same authentication of it, behind a load balancer that sends clients to any of them:
mimicd serve --listen.internal 10.0.1.10:7701 \
--internal.secret-file /etc/mimicd/internal-secret- A request or session that reaches a process not holding its document's partition is forwarded to the process that does.
- Leases on partitions are balanced among the processes.
- When a process stops (SIGTERM), it hands its partitions over first.
- When a process is lost, its leases lapse after
lease-ttl(5 seconds by default), and other processes take its partitions over as requests, sessions or webhooks need them. A process that was only paused can never write after its partition was taken over: the store refuses it.
Use --advertise.internal where peers reach a process at another address
than the one it listens on (0.0.0.0, a NAT). The internal listener is
authenticated by a shared secret or by certificates of your own PKI; see
Network and TLS.
Several stores
A deployment may spread its databases over several PostgreSQL databases, on one server or several. The first store is the home, which also holds the deployment's records (access data, settings, the partition map, backups' records, the audit trail); the others hold partitions only.
- A new database is placed on the active store holding the fewest partitions, or on the store its creation names.
- Partitions and whole databases move between stores while they serve. A store is emptied with a drain.
- Each store's write throughput is its own: spread write-heavy databases over more stores, or give a tenant's databases a store of their own.
| Lost | What happens |
|---|---|
| A store, not home | Its partitions answer unavailable; every other store's are served. /status names it (store_unreachable) |
| The home store | Processes stop being ready; moves, operations, backups and usage wait for it |
See PostgreSQL stores for adding stores and moving partitions.
Isolation between tenants
Databases share processes. Limits and budget groups divide what each database may take of them (see Limits), but they are not a hardware boundary. A tenant that needs its own storage and write throughput gets a store of its own; a tenant that needs its own compute gets a deployment of its own. The earlier server's isolation classes do not exist here.
More than one deployment
Deployments share nothing: each has its own stores, users, keys and settings, and a store records the deployment it belongs to, so a process started with another deployment's name refuses it (exit code 5). A database moves between deployments as an archive; see Backups and restores.