Skip to content

Commit b3ac463

Browse files
committed
multi instance
1 parent fb0d98b commit b3ac463

File tree

2 files changed

+251
-51
lines changed

2 files changed

+251
-51
lines changed

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Includes **pgvector** for AI/vector workloads out of the box.
88

99
- **Zero dependencies** - single binary, no installation required
1010
- **Embedded PostgreSQL 16** with pgvector pre-installed
11+
- **Multiple instances** - run multiple PostgreSQL servers simultaneously
1112
- Works on macOS (Apple Silicon), Linux (x86_64), and Windows (x64)
1213
- Bundled `psql` client - no separate installation needed
1314
- Data persists between restarts
@@ -68,6 +69,19 @@ pg0 info
6869

6970
# JSON output
7071
pg0 info -o json
72+
73+
# Info for a specific instance
74+
pg0 info --name myapp
75+
```
76+
77+
### List Instances
78+
79+
```bash
80+
# List all instances
81+
pg0 list
82+
83+
# JSON output
84+
pg0 list -o json
7185
```
7286

7387
### Open psql Shell
@@ -104,6 +118,35 @@ INSERT INTO items (embedding) VALUES ('[0.1, 0.2, ...]');
104118
SELECT * FROM items ORDER BY embedding <-> '[0.1, 0.2, ...]' LIMIT 5;
105119
```
106120

121+
### Multiple Instances
122+
123+
Run multiple PostgreSQL servers simultaneously using named instances:
124+
125+
```bash
126+
# Start multiple instances on different ports
127+
pg0 start --name app1 --port 5432
128+
pg0 start --name app2 --port 5433
129+
pg0 start --name test --port 5434
130+
131+
# List all instances
132+
pg0 list
133+
134+
# Get info for a specific instance
135+
pg0 info --name app1
136+
137+
# Connect to a specific instance
138+
pg0 psql --name app2
139+
140+
# Stop a specific instance
141+
pg0 stop --name test
142+
143+
# Stop all (one by one)
144+
pg0 stop --name app1
145+
pg0 stop --name app2
146+
```
147+
148+
Each instance has its own data directory at `~/.pg0/instances/<name>/data/`.
149+
107150
### Install Additional Extensions
108151

109152
For extensions beyond pgvector:
@@ -130,8 +173,9 @@ pg0 install-extension <name>
130173
pg0 start [OPTIONS]
131174
132175
Options:
176+
--name <NAME> Instance name [default: default]
133177
-p, --port <PORT> Port to listen on [default: 5432]
134-
-d, --data-dir <DATA_DIR> Data directory [default: ~/.pg0/data]
178+
-d, --data-dir <DATA_DIR> Data directory [default: ~/.pg0/instances/<name>/data]
135179
-u, --username <USERNAME> Username [default: postgres]
136180
-P, --password <PASSWORD> Password [default: postgres]
137181
-n, --database <DATABASE> Database name [default: postgres]
@@ -141,7 +185,7 @@ Options:
141185

142186
On first run, pg0 downloads PostgreSQL from [theseus-rs](https://github.com/theseus-rs/postgresql-binaries) and pgvector from pre-compiled binaries. These are cached in `~/.pg0/installation/` for subsequent runs.
143187

144-
Data is stored in `~/.pg0/data/` (or your custom `--data-dir`) and persists between restarts.
188+
Data is stored in `~/.pg0/instances/<name>/data/` (or your custom `--data-dir`) and persists between restarts.
145189

146190
## Build from Source
147191

0 commit comments

Comments
 (0)