Administration: RavenDB CLI
Running RavenDB as a console application provides basic information along with a command line interface which can be used for getting additional information about the server and in performing specific commands.
RavenDB can operate as 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:
rvn admin-channel [RavenDB process ID]
The rvn admin-channel
uses Named Pipe Connection, and can connect to RavenDB CLI only when running on the same machine as the server, and with appropriate privileges.
Information
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.
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 unintended a shutdown of the server).
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.
log <on|off|http-on|http-off|none|operations|information>
Parameters | Description |
---|---|
on or off |
enables or disables log printing |
http-on or http-off |
enables or disables HTTP request log information |
none , operations or information |
sets the log mode to desired level |
ravendb> log on
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
gc <0|1|2>
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.
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.
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.
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.
script <server|database> [database name]
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.
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.
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.
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.
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. |
clear
Clears the screen.
ravendb> clear
prompt
For usage type helpPrompt.
Can be used to show memory information used by stats while using rvn
.
ravendb> prompt %M
logout
Exits CLI back to the terminal (with rvn admin-channel
use only).
ravendb> logout
logo
Prints initial logo.
ravendb> logo
help
Display help screen.
ravendb> help
lowMem
Warning
Debugging command. Not intended for normal use.
Simulates low memory state in RavenDB.
ravendb> lowMem
timer
Warning
Debugging command. Not intended for normal use.
Enable (or disable) candidate selection timer (Rachis), or fires timeout immediately.
timer <on|off|fire>