# etcd

> etcd v3 gRPC through the pgetcd gateway, with revisions and leases in tables.

---

LLMS index: [llms.txt](/llms.txt)

---

etcd v3 clients such as `etcdctl` and `clientv3` connect to the **pgetcd** gateway over gRPC with mutual TLS. The
gateway evaluates each request in the `pg_etcd` extension. Keys, revisions, the event history and leases live in
PostgreSQL tables, and a response is sent only after a synchronous commit.

| Item | Detail |
| --- | --- |
| Status | **Release candidate.** `v0.1.0-rc2` (commit `81691bc`) is a local tag; the repository has no remote and nothing is published. Production high availability is post-MVP work. |
| Ports | gRPC with mTLS on 2379 (`listen`); diagnostics HTTPS on 2381 in examples (`diagnostics_listen`). Both settings are required. |
| Gateway | `pgetcd`, Go, etcd API 3.7.2, static binary; one process per tenant |
| Extension | `pg_etcd`, C; schema `etcd` with 7 tables; one Lease worker per database, at most 8 |
| Kernel patch | none; runs on stock PostgreSQL 18 |
| Licence | Apache-2.0; the etcd API and client are used as dependencies |
{.fields}

## How etcd maps onto PostgreSQL {#mapping}

- **Each request is one `READ COMMITTED` transaction.** It locks the single `etcd.meta` row, takes a fresh snapshot
  and evaluates.
- **Revisions** are a counter in the meta row, not a sequence. All changes in one request share one revision; a
  rollback uses none.
- **Reads** also write a logged publication barrier, so a read response, like a write, leaves only after a
  synchronous commit. An unknown commit outcome is never replayed.
- **Watch** streams complete revisions from the `events` table. `NOTIFY` is only a wake-up hint; polling recovers
  missed notifications.
- **Leases** are rows. After a restart every lease gets a full TTL again: a fault can delay expiry, never cause an
  early one.
- **Compact** is logical. `MemberList` and `Status` report one logical member.

## Supported API {#api}

`Range`, `Put`, `DeleteRange`, `Txn`, `Compact` (logical), `LeaseGrant`, `LeaseRevoke`, `LeaseTimeToLive`,
`LeaseLeases`, `LeaseKeepAlive`, `Watch`, `MemberList` and `Status`.

Not implemented: Auth, User and Role RPCs, member changes, other Maintenance RPCs, Lock and Election, and the
HTTP/JSON gateway. Without the HTTP/JSON gateway, Patroni cannot use pgetcd as its DCS yet.

## Source and credit {#source}

pgetcd is developed by PGSTY and pgetcd contributors. etcd is a project of the Cloud Native Computing Foundation;
Mimus is not affiliated with the etcd project.

Pages in this section adapt the pgetcd companion documentation, © PGSTY and pgetcd contributors, CC BY 4.0;
see [Licence and attribution](/license/#adapted).

---

Section pages:

- [Quick start](/docs/etcd/quickstart/): Build the gateway and extension, create a tenant, start pgetcd and check readiness.
- [Tutorials](/docs/etcd/tutorial/): Use pgetcd from etcdctl and from a Go client.
- [Compatibility](/docs/etcd/compatibility/): Supported RPCs, limits, differences from etcd and the evidence behind them.
- [Architecture](/docs/etcd/architecture/): Components, request paths, tenants and persistent state in pgetcd.
- [Reference](/docs/etcd/reference/): Gateway configuration and the SQL ABI of pg_etcd.
- [Operations](/docs/etcd/operations/): Monitor, troubleshoot and build pgetcd.
- [Status](/docs/etcd/status/): Current candidate, its test results, known issues and what remains for the MVP.
- [Releases](/docs/etcd/releases/): The release candidate and the acceptance checkpoints before it.
- [Design](/docs/etcd/design/): The decisions that define pgetcd, condensed from its design records.

---

Backlinks:

- [Protocol & Capability Matrix](/docs/reference/matrix/)
