# Quick start

> Install pgredis 0.1.0, configure PostgreSQL, start the gateway and run PING, SET and GET.

---

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

---

This guide sets up **pgredis 0.1.0** (extension schema `0.54`, ABI `3`, candidate `v0.1.0-rc1`) against a local PostgreSQL 18 instance and runs `PING`, `SET` and `GET` through `redis-cli` and SQL. Check [Compatibility](/docs/redis/compatibility/#scope) first to confirm that your workload only uses supported commands.

> [!NOTE]
> `v0.1.0-rc1` (2026-11-08, commit `11411411d72ab45456904cc602cefbb13b68ff25`) is an unpublished release candidate. No public download is available yet; install from a locally built development archive or build directly from source.

## Prerequisites {#prerequisites}

- Debian 13 (`amd64` or `arm64`) for development archives, or a Linux / macOS build host for source builds.
- PostgreSQL 18 (tested on 18.6) with `pg_config` (`postgresql-server-dev-18` on Debian).
- Superuser access to a dedicated PostgreSQL instance that you can configure and restart (`pg_redis` requires `superuser = true` and `shared_preload_libraries`).
- Python 3 (when running `install.py` from a development archive) and `redis-cli`.

## 1. Install the gateway and extension {#install}

If you have a `v0.1.0-rc1` development archive (`pgredis-0.1.0-pg18.6-debian13-amd64.tar.gz` or `pgredis-0.1.0-pg18.6-debian13-arm64.tar.gz`), verify its SHA-256 hash before extracting (`d72fdcb4f40d429e5b650d0671105c923db7ceb4425b50f68d45eea0d61e2ba8` for `amd64`; `4dcc546ef4c0562eb0b69500c0bbb43f664c3b955259ccde92900ef52e269cd7` for `arm64`):

```sh
pgredis_archive=pgredis-0.1.0-pg18.6-debian13-amd64.tar.gz
sha256sum "$pgredis_archive"
tar -xzf "$pgredis_archive" install.py
python3 -E install.py "$PWD/$pgredis_archive" \
  --pg-config /usr/lib/postgresql/18/bin/pg_config \
  --gateway-path /usr/local/bin/pgredis
pgredis -version
```

If you are installing from a source checkout instead of a development archive, build the Go gateway and C extension with `make build` and install the extension with `make -C extension PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config install`.

`pgredis -version` must print `pgredis 0.1.0`.

## 2. Configure PostgreSQL {#configure}

Add the following settings to `postgresql.conf`. If `shared_preload_libraries` already lists other modules, append `pg_redis` to the comma-separated list:

```ini
shared_preload_libraries = 'pg_redis'
pg_redis.maintenance_database = 'postgres'
pg_redis.maintenance_role = 'postgres'
max_prepared_transactions = 8
synchronous_commit = on
```

Add SCRAM authentication for the application role to `pg_hba.conf` before broader rules:

```text
host  pgredis_demo  pgredis_app  127.0.0.1/32  scram-sha-256
```

Restart PostgreSQL so `shared_preload_libraries` and `max_prepared_transactions` take effect.

## 3. Create the database, extension and role {#database}

Connect to PostgreSQL as a superuser and create the database, extension and application role:

```sql
CREATE DATABASE pgredis_demo;
\connect pgredis_demo
CREATE EXTENSION pg_redis;
SET password_encryption = 'scram-sha-256';
CREATE ROLE pgredis_app LOGIN;
\password pgredis_app
GRANT CONNECT, TEMPORARY ON DATABASE pgredis_demo TO pgredis_app;
GRANT USAGE ON SCHEMA redis TO pgredis_app;
GRANT EXECUTE ON FUNCTION
  redis._authorize(), redis._abi_version(), redis._read(), redis._write(),
  redis._dispatch(bytea[], integer), redis._dispatch(bytea[], integer, integer),
  redis._dispatch_single(bytea[], integer, integer), redis._pool_reset(),
  redis.command(text[], integer), redis.command_bin(bytea[], integer)
TO pgredis_app;
```

Verify the installed extension schema version and ABI:

```sql
SELECT extversion FROM pg_extension WHERE extname = 'pg_redis';  -- 0.54
SELECT redis._abi_version();                                     -- 3
```

The grants above allow ordinary data commands, transactions, blocking commands and Pub/Sub, but do not grant Redis administration commands such as `FLUSHALL`, `INFO`, `CONFIG` or `MONITOR`.

## 4. Start the gateway and run commands {#gateway}

Start the gateway on port `6379` (the Mimus planned Redis port) against PostgreSQL on port `5432`:

```sh
pgredis -listen 127.0.0.1:6379 -default-user pgredis_app \
  -pg 'postgres://127.0.0.1:5432/pgredis_demo?sslmode=disable'
```

> [!NOTE]
> If you omit `-listen` and `-pg`, the `pgredis` binary defaults to `127.0.0.1:56379` and `postgres://127.0.0.1:55432/pgredis`. Pass explicit flags so the port and database match your instance.

In a second terminal, run `PING`, `SET` and `GET` with `redis-cli`:

```sh
redis-cli -p 6379 --user pgredis_app --askpass PING
redis-cli -p 6379 --user pgredis_app --askpass SET greeting hello
redis-cli -p 6379 --user pgredis_app --askpass GET greeting
```

Enter the `pgredis_app` password when prompted. The commands return `PONG`, `OK` and `hello`. Because the key is stored in `pgredis_demo`, SQL queries on the same database see it immediately:

```sql
SELECT convert_from(redis.command(ARRAY['GET', 'greeting']), 'UTF8');
```

## Deployment notes {#notes}

- **Non-loopback listeners require TLS.** When `-listen` binds to a non-loopback address, you must pass `-tls-cert` and `-tls-key` or the gateway refuses to start.
- **One gateway per database.** Run one `pgredis` gateway process per PostgreSQL database; multiple gateways sharing one database are not verified.
- **Write serialization.** Write commands other than plain `GET` and `SET` take a per-database exclusive lock until commit; see [Per-database serialization](/docs/redis/compatibility/#serialization).
- **Schema upgrades.** When upgrading from extension schema `0.52` or `0.53`, replace the binaries and run `ALTER EXTENSION pg_redis UPDATE TO '0.54';` in each database.

---

Backlinks:

- [Tutorials](/docs/redis/tutorial/)
- [Transactional outbox](/docs/redis/tutorial/outbox/)
- [Connect a Redis client](/docs/redis/tutorial/redis-client/)
- [Roll back SQL and Redis together](/docs/redis/tutorial/sql-rollback/)
