WIP1: implementing JSON-RPC calls over Unix Sockets
This commit is contained in:
20
README.md
20
README.md
@@ -32,13 +32,31 @@ cargo build --release
|
||||
|
||||
### Running HeroDB
|
||||
|
||||
Launch HeroDB with the required `--admin-secret` flag, which encrypts the admin database (DB 0) and authorizes admin access. Optional flags include `--dir` for the database directory, `--port` for the TCP port (default 6379), `--sled` for the sled backend, and `--enable-rpc` to start the JSON-RPC management server on port 8080.
|
||||
Launch HeroDB with the required `--admin-secret` flag, which encrypts the admin database (DB 0) and authorizes admin access. Optional flags include `--dir` for the database directory, `--port` for the TCP port (default 6379), `--sled` for the sled backend, `--enable-rpc` to start the HTTP JSON-RPC server on a TCP port, `--enable-rpc-ipc` to start JSON-RPC over a Unix Domain Socket (non-HTTP), and `--rpc-ipc-path <path>` to specify the socket path (default: `/tmp/herodb.ipc`).
|
||||
|
||||
Example:
|
||||
```bash
|
||||
./target/release/herodb --dir /tmp/herodb --admin-secret myadminsecret --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 myadminsecret --enable-rpc-ipc --rpc-ipc-path /tmp/herodb.sock
|
||||
```
|
||||
|
||||
Test the IPC endpoint interactively with socat:
|
||||
```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}
|
||||
```
|
||||
|
||||
For a one-liner that auto-computes Content-Length and pretty-prints the JSON response, see docs/rpc_examples.md.
|
||||
|
||||
For detailed launch options, see [Basics](docs/basics.md).
|
||||
|
||||
## Usage with Redis Clients
|
||||
|
Reference in New Issue
Block a user