> ## Documentation Index
> Fetch the complete documentation index at: https://xoxno.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Day-2 operations

> Database pruning, config reapply, doctor diagnostics, keygen, metrics, and the bundled benchmark.

Database pruning, config reapply, doctor diagnostics, keygen, metrics, and the bundled benchmark.

## Shortest commands

```bash theme={"system"}
mxnode doctor                         # health check
mxnode reapply-config                 # rewrite per-node TOML from current config
mxnode db prune --node 0              # trim old block data
mxnode benchmark                      # host capability check
```

## Database

`mxnode db` operates on the per-node `db/` directory under each workdir.

### Trim old data

```bash theme={"system"}
mxnode db prune --node 0
```

| Flag           | Default     | Effect                            |
| -------------- | ----------- | --------------------------------- |
| `--node N`     | required    | Node index. Repeatable.           |
| `--epochs <K>` | from config | Keep last K epochs; remove older. |

### Wipe a node's database

```bash theme={"system"}
mxnode db remove --node 0 --yes
```

The node will resync from peers on next start. `--yes` is required.

### Reseed from genesis

```bash theme={"system"}
mxnode db reseed --node 0 --yes
```

Equivalent to `db remove` followed by an immediate restart.

<Warning>
  `db reseed` can take many hours for an out-of-sync mainnet node. Run it in a screen / tmux session.
</Warning>

## Reapply config

```bash theme={"system"}
mxnode reapply-config
```

Walks every node, re-stamps `prefs.toml` (display name, observer pins, your prefs overrides) and `config.toml` (DbLookupExtensions, your config overrides), and writes them back. Use after editing `[overrides.prefs]` or `[overrides.config]` in `~/.config/mxnode/config.toml`.

| Flag        | Default | Effect                               |
| ----------- | ------- | ------------------------------------ |
| `--node N`  | all     | Limit to specific nodes. Repeatable. |
| `--restart` | off     | Restart units after the rewrite.     |

```bash theme={"system"}
mxnode reapply-config --node 0 --node 1
mxnode reapply-config --restart
```

`reapply-config` does **not** touch `RedundancyLevel` — that's an install-time choice via `--backup`.

## Doctor

```bash theme={"system"}
mxnode doctor
```

One-shot host diagnostic. Exits non-zero on any `Error` finding.

```
✓ [config] loaded successfully
✓ [platform] linux (systemd)
✓ [systemctl] systemctl is on PATH
✓ [journalctl] journalctl is on PATH
✓ [state] state.toml schema_version=1
✓ [paths.state] /home/<you>/.local/state/mxnode is writable
✓ [paths.runtime] /run/user/1000/mxnode (will be created on demand)
✓ [paths.binaries] /home/<you>/mxnode/binaries is writable
✓ [inflight] no inflight.toml
✓ [supervisor-dir] readable: /etc/systemd/system
✓ [p2p ports] tcp 37373..38383 bindable on 0.0.0.0
```

JSON for monitoring stacks:

```bash theme={"system"}
mxnode --json doctor
```

Use as a CI gate before `start --all`:

```bash theme={"system"}
mxnode doctor && mxnode start --all
```

## Keygen

Standalone wrapper around `mx-chain-go`'s `keygenerator`. Generates `validatorKey.pem` (the BLS key) into the chosen output directory.

```bash theme={"system"}
mxnode keygen
```

| Flag              | Default                       | Effect                                     |
| ----------------- | ----------------------------- | ------------------------------------------ |
| `--for N`         | none                          | Annotate output for a specific node index. |
| `--output <PATH>` | `<custom_home>/elrond-utils/` | Where to write the `.pem` files.           |

```bash theme={"system"}
mxnode keygen --for 3 --output ~/keys/node-3
```

The keygenerator binary is built and placed at `<custom_home>/elrond-utils/keygenerator` during the first `mxnode install`. mxnode does **not** pre-generate observer keys at install time — observers auto-generate on first start.

## Keys check

```bash theme={"system"}
mxnode keys check
```

Verifies `<node_keys>/node-{i}.zip` exists for every **validator** node. Observer / multikey nodes are skipped.

```
key dir: /home/<you>/VALIDATOR_KEYS
  ✓ node-0: node-0.zip (present)
  ✗ node-1: node-1.zip (missing)

1 node(s) have no zip yet — drop them in /home/<you>/VALIDATOR_KEYS before running `mxnode start`.
```

For an observer-only or multikey-only install:

```
no validator nodes in state.toml — observer/multikey installs use auto-generated keys
```

## Benchmark

```bash theme={"system"}
mxnode benchmark
```

Roughly 30 seconds. Prints CPU, memory, disk IOPS, and network latency measurements with pass/fail thresholds derived from MultiversX validator requirements. Use before committing to running validators on a new host.

## Configuration commands

Already covered in [configuration](/mxnode/configuration), summarized here:

| Command                                                   | Purpose                                            |
| --------------------------------------------------------- | -------------------------------------------------- |
| `mxnode config show [--origin] [--format toml\|json]`     | Print the merged config                            |
| `mxnode config get <path>`                                | One dotted-path lookup                             |
| `mxnode config set <path> <value> [--scope user\|system]` | Update one value                                   |
| `mxnode config edit [--scope user\|system]`               | Open the file in `$EDITOR`                         |
| `mxnode config validate [--strict]`                       | Schema check; `--strict` adds network reachability |

## Version

```bash theme={"system"}
mxnode --version
mxnode version
mxnode --json version
```

The JSON form includes the schema version so monitoring stacks can detect upgrades.
