---
title: "Administration: RavenDB CLI"
description: "Manage your RavenDB server from the command line with CLI commands for stats, logging, certificate generation, and cluster operations."
url: "https://docs.ravendb.net/7.2/server/administration/cli"
version: "7.2"
---

# Administration: RavenDB CLI

> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

## Administration: RavenDB CLI

> **Note**
>
> - Running RavenDB as a console application offers basic information along with
>   a Command Line Interface that can be used to get additional information regarding
>   the server and perform specific commands.
>
> - This page lists available CLI commands and explains their usage.
>
> - In this page:
>   - [`rvn`](#rvn)
>   - [`info`](#info)
>   - [`stats`](#stats)
>   - [`log`](#log)
>   - [`gc`](#gc)
>   - [`shutdown | q`](#shutdown-|-q)
>   - [`restartServer`, `resetServer`](#restartserver,-resetserver)
>   - [`script`](#script)
>   - [`generateClientCert`](#generateclientcert)
>   - [`trustServerCert`](#trustservercert)
>   - [`trustClientCert`](#trustclientcert)
>   - [`replaceClusterCert`](#replaceclustercert)
>   - [`triggerCertificateRefresh`](#triggercertificaterefresh)
>   - [`clear`](#clear)
>   - [`prompt`](#prompt)
>   - [`logout`](#logout)
>   - [`logo`](#logo)
>   - [`help`](#help)
>   - [`lowMem`](#lowmem)
>   - [`timer`](#timer)

## `rvn`

RavenDB can operate as a service/daemon without console input.  
It is possible to access the CLI through a provided `rvn` (`rvn.exe` in Windows)
tool included in each distribution package.

The process is as follows:

```bash
rvn admin-channel [RavenDB process ID]
```

The `rvn admin-channel` uses [Named Pipe Connection](https://en.wikipedia.org/wiki/Named_pipe),
and can connect to RavenDB CLI only when running on the same machine as the server and with
appropriate privileges.

> **Info**
>
> The `rvn` executable can be found in the distribution package under **Server** directory

## `info`

Prints basic information to the console, including build version information, process ID (PID),
bitness, and system hardware information.

```text
ravendb> info
Node A in cluster eabe7a24-054a-48ef-9391-7f7b7707969d
Build 40050, Version 4.0, SemVer 4.0.0, Commit fffffff
PID 17591, 64 bits, 8 Cores, Arch: X64
31.122 GBytes Physical Memory, 28.908 GBytes Available Memory
Using GC in server concurrent mode retaining memory from the OS.
```

## `stats`

Online display of memory usage by RavenDB. You can separate into Working Set, Native Mem,
Managed Mem, and Memory Mapped Size. Hitting any key will return to CLI's input mode (beware
not to hit Ctrl+C / Break to avoid an unintended shutdown of the server).

```text
ravendb> stats
Showing stats, press any key to close...
  working set   | native mem   | managed mem  | mmap size   | reqs/sec | docs (all dbs)
+  201.45 MBytes | 17.36 MBytes | 42.45 MBytes | 2.02 GBytes | 0        |      5,374,826
```

## `log`

Enable (or disable) online log printing to the console.

```text
log [on|off] [http-]<on|off> [info|debug] [no-console]
```

| Parameters | Description |
| - | - |
| `http-on` or `http-off` | Enables or disables HTTP requests log information |
| `info`, `debug` | Sets logging to the requested [level](https://docs.ravendb.net/7.2/monitoring/logging/configuration.md#logsminlevel) |
| `on` or `off` | Enables or disables log printing |
| `no-console` | Disables logging to console |

> **Note:** Examples {#examples}
>
> Print to log:
>
> ```text
> ravendb> log on
> ```
>
> Set logging to `debug` level:
>
> ```text
> ravendb> log debug
> ```
>
> Set logging to `debug` level but do not log to the console:
>
> ```text
> ravendb> log debug no-console
> ```

> **Note**
>
> If log is enabled using `rvn admin-channel`, the information will be displayed
> in the main console application. If RavenDB is running as a service, you will see the
> log output in the service log.

## `gc`

Force Garbage Collection to a specific generation (0, 1 or 2).  
See [GC.Collect Method](https://docs.microsoft.com/en-us/dotnet/api/system.gc.collect?redirectedfrom=MSDN\&view=netframework-4.7.2#System_GC_Collect_System_Int32_)

```text
gc <0|1|2>
```

```text
ravendb> gc 2
Before collecting, managed memory used: 48.92 MBytes
Garbage Collecting... Collected.
After collecting, managed memory used:  10.09 MBytes at 0.0078154 Seconds
```

## `shutdown | q`

Gracefully shuts down the Server.

```text
ravendb> q

Are you sure you want to reset the server ? [y/N] : y
Starting shut down...
Shutdown completed
```

| Parameters | Description |
| - | - |
| `no-confirmation` | Skips the confirmation question and shuts down immediately. |

## `restartServer`, `resetServer`

Gracefully shut down and restart the Server.

```text
ravendb> restartServer

Are you sure you want to reset the server ? [y/N] : y
Starting shut down...
Shutdown completed

Restarting Server...
Using GC in server concurrent mode retaining memory from the OS.
Node A in cluster eabe7a24-054a-48ef-9391-7f7b7707969d
Server available on: http://rave-pc:8080
Tcp listening on 0.0.0.0:32797
Server started, listening to requests...
TIP: type 'help' to list the available commands.
ravendb> 
```

The two commands are equivalent.

```text
ravendb> resetServer

Are you sure you want to reset the server ? [y/N] : y
Starting shut down...
Shutdown completed

Restarting Server...
Using GC in server concurrent mode retaining memory from the OS.
Node A in cluster eabe7a24-054a-48ef-9391-7f7b7707969d
Server available on: http://rave-pc:8080
Tcp listening on 0.0.0.0:32797
Server started, listening to requests...
TIP: type 'help' to list the available commands.
ravendb> 
```

## `script`

Executes Admin JavaScript patches.

```text
script <server|database> [database name]
```

```text
ravendb> script database ProductionDB

Enter JavaScript:
(to cancel enter in new line 'cancel' or 'EXEC' to execute)

>>> return database.Configuration.Storage.MaxConcurrentFlushes
>>> EXEC
{ "Result" : 10 }
ravendb> 
```

> **Danger**
>
> Running scripts can harm the database beyond recovery. Use with care.

## `generateClientCert`

Generate a new trusted client certificate with `ClusterAdmin` security clearance.

```text
ravendb> generateClientCert <name> <path to output folder> <number of months until expiration> [password]
```

| Parameters | Description |
| - | - |
| `name` | The name of the client certificate that is to be generated. |
| `path to output folder` | The path to the certificate. The path is relative to the **server** folder in RavenDB. |
| `number of months until expiration` | The number of months you want the certificate to last before it expires. |
| `password` | The certificate's password. **Optional**. |

## `trustServerCert`

Register a server certificate of another node to be trusted on this server.  
This is required when building a cluster where each node has a different certificate.

```text
ravendb> trustServerCert <name> <path to pfx> [password]
```

| Parameters | Description |
| - | - |
| `name` | The name of the server certificate that is to be trusted. |
| `path to pfx` | The path to the certificate. |
| `password` | The certificate's password, if it has one. |

## `trustClientCert`

Register a client certificate to be trusted on this server with `ClusterAdmin` security clearance.

```text
ravendb> trustClientCert <name> <path to pfx> [password]
```

| Parameters | Description |
| - | - |
| `name` | The name of the client certificate that is to be trusted. |
| `path to pfx` | The path to the certificate. |
| `password` | The certificate's password, if it has one. |

## `replaceClusterCert`

Replace the cluster certificate.

> **Danger**
>
> If **replaceImmediately** is specified, RavenDB will replace the certificate by force,
> even if some nodes are not responding. In that case, you will have to manually replace the
> certificate in those nodes. Use with care.

```text
ravendb> replaceClusterCert [-replaceImmediately] <name> <path to pfx> [password]
```

| Parameters | Description |
| - | - |
| `-replaceImmediately` | Whether to force replace the cluster certificate even if some nodes are not responding. Optional, use with caution. |
| `name` | The name of the new cluster certificate. |
| `path to pfx` | The path to the certificate. |
| `password` | The certificate's password, if it has one. |

## `triggerCertificateRefresh`

Manually trigger a certificate refresh cycle.  
Normally, RavenDB checks for certificate renewal once an hour automatically.  
This command runs that same check immediately on demand.

When the server is configured to use a Let's Encrypt certificate obtained via the [Setup Wizard](https://docs.ravendb.net/7.2/start/installation/setup-wizard/overview.md),
this command contacts Let's Encrypt and renews the certificate if it is within 30 days of expiry,
then distributes the new certificate across all cluster nodes.

```text
ravendb> triggerCertificateRefresh [-replaceImmediately]
```

| Parameters | Description |
| - | - |
| `-replaceImmediately` | Force immediate replacement across the cluster, even if some nodes are not responding.<br />Optional, use with caution. |

---

## `clear`

Clears the screen.

```text
ravendb> clear
```

## `prompt`

For usage type **helpPrompt**.

Can be used to show memory information used by **stats** while using `rvn`.

```text
ravendb> prompt %M
```

## `logout`

Exits CLI back to the terminal (with `rvn admin-channel` use only).

```text
ravendb> logout
```

## `logo`

Prints initial logo.

```text
ravendb> logo
```

## `help`

Display help screen.

```text
ravendb> help
```

---

## `lowMem`

> **Warning**
>
> Debugging command. Not intended for normal use.

Simulates low memory state in RavenDB.

```text
ravendb> lowMem
```

## `timer`

> **Warning**
>
> Debugging command. Not intended for normal use.

Enable (or disable) candidate selection timer (Rachis), or fires timeout immediately.

```text
timer <on|off|fire>
```
