MIRAJv1.0
EN

2. Installation

2.1 Prerequisites#

MIRAJ is distributed as ready-to-use binaries for 64-bit Windows (Standard 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:\donnees --log

This command opens (or creates if it does not exist) the data folder D:\donnees, 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.

OptionDefault valueEffect
--root <folder>dataData folder to open (created if it does not exist).
--config <file.xml><folder>/miraj_config.xmlConfiguration file to use instead of the one in the data folder.
--bind <address>127.0.0.1Address the server listens on.
--port <port>7007TCP port to listen on (--port 0 lets the system choose a free port).
--logdisabledMaintains <folder>/miraj/server.log (SQL errors, bugs, server incidents; successful queries are not recorded).
--lang <code>enLanguage of session error messages: en, fr, zh, hi, es, ar, pt, ru, de, ja.
--result-buffer <MB>64Memory kept per connection for a client that is slow to read its result.
--write-timeout <seconds>60Maximum wait for a client that has stopped reading its result, before disconnecting it (net_write_timeout).
--connect-timeout <seconds>10Maximum 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>50Maximum wait for an explicit table lock (LOCK TABLES) before error 1205.
--deferred-update ON|OFFONDeferred 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|pessimisticmvoccConcurrency 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 serverFolder 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>8192Size from which a BLOB value leaves the table for the table's separate store.
--lob-cache <MB>128Size of the read cache for externalized BLOBs.
--event-scheduler ON|OFF|DISABLEDOFFState of the event scheduler at startup (DISABLED forbids enabling it afterwards).
--parallel-threads <n>one per coreThreads that all of the server's queries may occupy in total (Standard/Cluster edition; no effect in Express).
--save-policy relaxed|statement|periodicrelaxedWrite durability policy (see 11. Server Administration).
--save-interval <milliseconds>5000Interval of the periodic journal flush (save-policy relaxed or periodic).
--slow-query-logdisabledEnables the slow query log.
--slow-query-log-file <file><folder>/miraj/slow.logSlow query log file (also enables it).
--long-query-time <seconds>10Duration 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>noneTLS certificate and private key; the server then offers encryption at connection time. These two options go together.
--require-tlsdisabledRejects clients that do not connect over TLS (requires --tls-cert/--tls-key).
--cluster-config <cluster.toml>cluster.toml file next to the executableNode 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:\donnees
MIRAJ 1.0.0 Standard - tapez \help pour l'aide, \q pour quitter.
miraj>

Command-line options#

OptionEffect
--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.
--jsonDisplays results as JSON rather than as a table.
--timingDisplays the execution time of each statement.
--no-historyNeither 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:\donnees\
├── 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 .mrj file in its database's subfolder, in the internal MIRA v2 format.
  • BLOB values of a table whose size exceeds --lob-threshold are kept in a separate store, <table>.bmrj, next to the .mrj file.
  • 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-server listens only on 127.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 root account 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-dir to 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.toml file.
  • On Windows, if cargo is not in the PATH:
    $env:Path = "$env:USERPROFILE\.cargo\bin;$env:Path"

Building the Standard edition (multi-core)#

cargo build --workspace --release

Building the Express edition (free, single-threaded)#

Editions are selected by the parallel Cargo feature, enabled by default:

cargo build --workspace --release --no-default-features

Verifying the build#

cargo test --workspace
cargo test --workspace --no-default-features
cargo clippy --workspace --all-targets

Starting the compiled binaries#

target/release/miraj-server --root D:\donnees --lang fr
target/release/miraj-cli --help

The Cluster edition is built with the cluster Cargo feature (cargo build --workspace --release --features cluster); see 12. Cluster and Replication.