WIP1: implementing JSON-RPC calls over Unix Sockets
This commit is contained in:
@@ -9,8 +9,10 @@ To launch HeroDB, use the binary with required and optional flags. The `--admin-
|
||||
- `--port <port>`: TCP port for Redis protocol (default: 6379).
|
||||
- `--debug`: Enable debug logging.
|
||||
- `--sled`: Use Sled backend (default: Redb).
|
||||
- `--enable-rpc`: Start JSON-RPC management server on port 8080.
|
||||
- `--enable-rpc`: Start JSON-RPC management server on port 8080 (HTTP over TCP).
|
||||
- `--rpc-port <port>`: Custom RPC port (default: 8080).
|
||||
- `--enable-rpc-ipc`: Start JSON-RPC over a Unix Domain Socket (non-HTTP).
|
||||
- `--rpc-ipc-path <path>`: Path to the Unix socket for IPC (default: `/tmp/herodb.ipc`).
|
||||
- `--admin-secret <secret>`: Required secret for DB 0 encryption and admin access.
|
||||
|
||||
Example:
|
||||
@@ -18,6 +20,23 @@ Example:
|
||||
./target/release/herodb --dir /tmp/herodb --admin-secret mysecret --port 6379 --enable-rpc
|
||||
```
|
||||
|
||||
To enable JSON-RPC over a Unix Domain Socket at `/tmp/herodb.sock`:
|
||||
```bash
|
||||
./target/release/herodb --dir /tmp/herodb --admin-secret mysecret --enable-rpc-ipc --rpc-ipc-path /tmp/herodb.sock
|
||||
```
|
||||
|
||||
Test the IPC endpoint interactively with socat (non-HTTP transport):
|
||||
```bash
|
||||
sudo socat -d -d -t 5 - UNIX-CONNECT:/tmp/herodb.sock
|
||||
```
|
||||
Then paste a framed JSON-RPC request (Content-Length header, blank line, then JSON body). Example:
|
||||
```
|
||||
Content-Length: 73
|
||||
|
||||
{"jsonrpc":"2.0","method":"hero_listDatabases","params":[],"id":3}
|
||||
```
|
||||
More IPC examples are in [docs/rpc_examples.md](docs/rpc_examples.md).
|
||||
|
||||
Deprecated flags (`--encrypt`, `--encryption-key`) are ignored for data DBs; per-database encryption is managed via RPC.
|
||||
|
||||
## Admin Database (DB 0)
|
||||
|
Reference in New Issue
Block a user