Client#
mcli is the MuduDB command-line client. It supports interactive SQL, HTTP administration, and procedure invocation.
Connection options#
--addr <host:port>— TCP protocol endpoint for SQL shell and procedure invocation (default127.0.0.1:9527).--http-addr <host:port>— HTTP management endpoint for admin commands (default127.0.0.1:8300).
Interactive SQL shell#
mcli --addr 127.0.0.1:9527 shell --app demo
Inside the shell you can run SQL statements, meta commands, and exit with \q.
Common admin commands#
List installed applications:
mcli --http-addr 127.0.0.1:8300 app-list
Show server topology:
mcli --http-addr 127.0.0.1:8300 server-topology
Resolve a partition route:
mcli --http-addr 127.0.0.1:8300 partition-route --rule-name user_rule --key user-100
Invoke a procedure#
mcli --addr 127.0.0.1:9527 --http-addr 127.0.0.1:8300 app-invoke \
--app wallet \
--module wallet \
--proc transfer_funds \
--json '{"from_user_id": 1001, "to_user_id": 1002, "amount": 1200}'
Standalone adapter connection#
Programs that run procedures through the standalone adapter (mudu_adapter) — rather than through mcli — read the MUDU_CONNECTION environment variable to pick a backend. When the variable is unset, the adapter defaults to sqlite:///tmp/mududb.db.
Scheme |
Backend |
Example |
|---|---|---|
|
SQLite file |
|
|
PostgreSQL |
|
|
MySQL |
|
|
MuduDB server |
|
A sqlite: prefix or a bare path is also treated as a SQLite file path. For the mudud:// form, the app name defaults to default and the http_addr query parameter defaults to 127.0.0.1:8300; see Adapter configuration for the query parameters.
Output#
Query results are displayed as a table by default in TTY sessions.
Management commands output pretty JSON by default; add
--compactfor compact JSON.On error,
mcliexits non-zero and prints the error to stderr.
See mcli Management Interface (HTTP) for the full command reference.