2. Installation
2.1 Prerequisites#
MIRAJ is distributed as ready-to-use binaries for 64-bit Windows (Enterprise and Express editions), with no external dependencies to install. Choose the archive matching the edition you want (see 1.3): it contains miraj-server.exe, miraj-cli.exe and, for embedded use from a Delphi or C++ application or any language able to load a C DLL, miraj.dll.
A 32-bit library (miraj.dll built for Win32 applications) is available separately for applications that need it; the default 64-bit executable cannot be loaded by a 32-bit process.
No installation in the sense of an installer is required: copy the executables wherever you like and run them. The folder from which miraj-server or miraj-cli is launched does not matter: it is the data folder (--root) that determines where your databases live.
To build MIRAJ yourself (other platforms, debugging, contributing), see 2.7.
2.2 Starting miraj-server#
miraj-server.exe --root D:\data --logThis command opens (or creates if it does not exist) the data folder D:\data, then starts listening on 127.0.0.1:7007. The local root account, with no password, is created automatically the first time the folder is opened.
Command-line options#
All options accept a case-insensitive name (--Root and --root are equivalent). miraj-server --help displays the complete list.
| Option | Default value | Effect |
|---|---|---|
--root <folder> | data | Data folder to open (created if it does not exist). |
--config <file.xml> | <folder>/miraj_config.xml | Configuration file to use instead of the one in the data folder. |
--bind <address> | 127.0.0.1 | Address the server listens on. |
--port <port> | 7007 | TCP port to listen on (--port 0 lets the system choose a free port). |
--log | disabled | Maintains <folder>/miraj/server.log (SQL errors, bugs, server incidents; successful queries are not recorded). |
--lang <code> | en | Language of session error messages: en, fr, zh, hi, es, ar, pt, ru, de, ja. |
--result-buffer <MB> | 64 | Memory kept per connection for a client that is slow to read its result. |
--write-timeout <seconds> | 60 | Maximum wait for a client that has stopped reading its result, before disconnecting it (net_write_timeout). |
--connect-timeout <seconds> | 10 | Maximum time to complete a client's handshake (connect_timeout). |
--idle-timeout <seconds> | 28800 (8 h) | Maximum time between two commands from an already connected client (wait_timeout). |
--lock-wait-timeout <seconds> | 50 | Maximum wait for an explicit table lock (LOCK TABLES) before error 1205. |
--deferred-update ON|OFF | ON | Deferred update of UPDATE statements targeting a single row by its key: they are re-evaluated at COMMIT rather than taking the row (see 9. Transactions and Concurrency). |
--concurrency mvocc|pessimistic | mvocc | Concurrency model: optimistic multiversion control (no waiting on rows) or classic row locks. Temporary option, while the two models are being compared. |
--key-dir <folder> | profile of the account running the server | Folder holding the keys of the encrypted account vault, kept outside the data folder (see 11. Server Administration). |
--reset-accounts | — | Recreates the account vault with only the local root, with no password (used alone, with --root and optionally --key-dir). |
--secure-file-priv <folder> | empty (LOAD_FILE disabled) | Only folder readable by LOAD_FILE, for accounts holding the FILE privilege. |
--lob-threshold <bytes> | 8192 | Size from which a BLOB value leaves the table for the table's separate store. |
--lob-cache <MB> | 128 | Size of the read cache for externalized BLOBs. |
--event-scheduler ON|OFF|DISABLED | OFF | State of the event scheduler at startup (DISABLED forbids enabling it afterwards). |
--parallel-threads <n> | one per core | Threads that all of the server's queries may occupy in total (Enterprise/Cluster edition; no effect in Express). |
--save-policy relaxed|statement|periodic | relaxed | Write durability policy (see 11. Server Administration). |
--save-interval <milliseconds> | 5000 | Interval of the periodic journal flush (save-policy relaxed or periodic). |
--slow-query-log | disabled | Enables the slow query log. |
--slow-query-log-file <file> | <folder>/miraj/slow.log | Slow query log file (also enables it). |
--long-query-time <seconds> | 10 | Duration beyond which a statement is a slow query. |
--max-statement-time <seconds> | 0 (no limit) | Duration beyond which a statement is automatically aborted. |
--tls-cert <file.pem> / --tls-key <file.pem> | none | TLS certificate and private key; the server then offers encryption at connection time. These two options go together. |
--require-tls | disabled | Rejects clients that do not connect over TLS (requires --tls-cert/--tls-key). |
--cluster-config <cluster.toml> | cluster.toml file next to the executable | Node configuration file, Cluster edition only. |
--help, -h, /? | — | Displays usage and exits. |
Each command-line option can also be set permanently in miraj_config.xml (see 2.4); in case of conflict, the command line takes precedence.
2.3 Installing and Using miraj-cli#
miraj-cli needs no particular installation: it is a standalone executable that directly opens a data folder, without going through a network server.
miraj-cli.exe --root D:\dataMIRAJ 1.0.0 Enterprise - tapez \help pour l'aide, \q pour quitter.
miraj>Command-line options#
| Option | Effect |
|---|---|
--root <folder> | Data folder to open (data by default). |
--config <file.xml> | Configuration file to use instead of the one in the data folder. |
-d <database> | Selects a database at startup (equivalent to USE <database>). |
-e "<SQL>" | Executes the given statement then exits, without starting interactive mode. |
--lang <code> | Language of error messages: en, fr, zh, hi, es, ar, pt, ru, de, ja. |
--json | Displays results as JSON rather than as a table. |
--timing | Displays the execution time of each statement. |
--no-history | Neither reads nor writes the history of entered statements. |
<file.sql> | Executes the given file then exits. |
See 13. miraj-cli for the complete reference of interactive mode commands (\d, \l, \history, source, etc.).
2.4 Configuration File#
Like a classic SQL server configuration file, MIRAJ reads an XML file at startup:
<data folder>/miraj_config.xml— your settings, read at startup. If it does not exist yet, MIRAJ creates a commented skeleton.<data folder>/miraj_default.xml— regenerated at every startup, lists all recognized variables with their default value. It is a reference document only: it is never read back by the server.
Order of precedence, from lowest to highest: engine default value, then miraj_config.xml, then command-line argument.
2.5 Data Folder Layout#
The data folder (--root) is the unit of administration of a MIRAJ server or console: everything belonging to an installation resides there.
D:\data\
├── miraj_config.xml (your settings)
├── miraj_default.xml (reference, regenerated at every startup)
├── miraj\
│ ├── accounts.mra (encrypted account vault)
│ ├── server.log (with --log: errors, bugs, incidents)
│ └── slow.log (with --slow-query-log)
└── ma_base\ (one database = one subfolder)
├── journal.mrl (the database's write journal)
├── clients.mrj (one table = one .mrj file)
└── clients.bmrj (the table's externalized BLOBs, if any)- One database = one subfolder of the data folder.
- One table = one
.mrjfile in its database's subfolder, in the internal MIRA v2 format. BLOBvalues of a table whose size exceeds--lob-thresholdare kept in a separate store,<table>.bmrj, next to the.mrjfile.- Each database has its own write journal,
journal.mrl, replayed on opening if the last shutdown was not clean. - The account vault (
accounts.mra) is shared by the data folder; it is encrypted, and its key is stored outside the data folder by default (see below and 11. Server Administration).
2.6 Default Security#
- Local listening only. Without
--bind,miraj-serverlistens only on127.0.0.1: no remote machine can connect to it until you have explicitly chosen another listening address. - Administrator account created on first launch. When the data folder is created, a local
rootaccount with no password is created automatically; it is the only type of account authorized to manage other accounts. Give it a password as soon as possible:ALTER USER root@localhost IDENTIFIED BY 'un-mot-de-passe-solide'; - Account vault keys stored outside the data folder, by default in the profile of the account running the server (
--key-dirto choose another location).
Details on account management, privileges, encryption in transit (TLS) and monitoring are covered in 11. Server Administration and 10. Accounts and Privileges.
2.7 Building from Source#
This section is intended for advanced users who want to build MIRAJ themselves (other platform, debugging, continuous integration).
Prerequisites#
- rustup; the exact toolchain (1.98.1) is installed automatically thanks to the repository's
rust-toolchain.tomlfile. - On Windows, if
cargois not in thePATH:$env:Path = "$env:USERPROFILE\.cargo\bin;$env:Path"
Building the Enterprise edition (multi-core)#
cargo build --workspace --releaseBuilding the Express edition (free, single-threaded)#
Editions are selected by the parallel Cargo feature, enabled by default:
cargo build --workspace --release --no-default-featuresVerifying the build#
cargo test --workspace
cargo test --workspace --no-default-features
cargo clippy --workspace --all-targetsStarting the compiled binaries#
target/release/miraj-server --root D:\data --lang fr
target/release/miraj-cli --helpThe Cluster edition is built with the cluster Cargo feature (cargo build --workspace --release --features cluster); see 12. Cluster and Replication.