Installation: Running as a Service

Prerequisites

The prerequisites for running RavenDB as a Service are defined here.

After completing the Server configuration process either via the Setup Wizard or Manually, you can register the Server as a Service using the rvn tool that can be found inside the RavenDB Server distribution package.

Windows

Registering

To register as a Service on the Windows operating system you need to execute the following command:

.\rvn.exe windows-service register --service-name RavenDB

If you want to run the service under a non-default user (Local Service is default) then execute following command:

.\rvn.exe windows-service register --service-name RavenDB --service-user-name MyUser --service-user-password MyPassword

Unregistering

To remove the Service, use the 'unregister' command as follows:

.\rvn.exe windows-service unregister --service-name RavenDB

Starting and Stopping

Service can be also controlled using the start and stop commands:

.\rvn.exe windows-service stop --service-name RavenDB
.\rvn.exe windows-service start --service-name RavenDB

Linux - Ubuntu 16.04

Open a bash terminal, and create the following file /etc/systemd/system/ravendb.service, using super user permissions:

[Unit]
Description=RavenDB v4.0
After=network.target

[Service]
LimitCORE=infinity
LimitNOFILE=65536
LimitRSS=infinity
LimitAS=infinity
User=<desired-user>
Restart=on-failure
Type=simple
ExecStart=<path-to-RavenDB>/run.sh

[Install]
WantedBy=multi-user.target

Note: Replace <desired-user> with your username and <path-to-RavenDB> with your path.

Then register the service and enable it on startup:

systemctl daemon-reload
systemctl enable ravendb.service

Start the service:

systemctl start ravendb.service

View its status using:

systemctl status ravendb.service
or
journalctl -f -u ravendb.service