RavenDB 2.x  Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action – exploring the Start.cmd file

We will open Start.cmd in the Notepad application to learn how RavenDB would be launched.

  1. In Windows Explorer, go to C:\RavenDB-Build-2375.
  2. Select the Start.cmd file and open it in the Notepad application. It should look like this:

What just happened?

In steps 1 and 2, we opened the Start.cmd file and took a look at its command line parameters.

The Raven.Server.exe file is launched with two parameters --debug and --browser. The debug parameter is used by developers for applications debugging purposes and the browser parameter is used to open the Management Studio in the web browser automatically.

Configuring the RavenDB server

Before launching the RavenDB server, you might need to configure it. We can do configuration by editing the Raven.server.exe.config file located in the Server directory. This is a text file and can be edited and modified with the Notepad application.

There are three key-values in the appSettings section. These keys settings that you can modify to meet your needs are:

  • Raven/Port: This setting represents the TCP/IP listening port
  • Raven/DataDir: This setting lets you define the directory where the data will be stored
  • Raven/AnonymousAccess: This setting defines the security level access which you can use to define which user can do which action on the server

Raven.Server.exe runs by default on port 8080. The Start.cmd file will run the Raven.Server.exe file with the command-line parameter –browser. This will automatically open the Management Studio in the web browser and point to this location: http://hostname:port/raven/studio.html.

Note

A few points to be noted about default values:

  • The * value assigned to the Raven/Port indicates that RavenDB will find the first available port from 8080 and upward. By default, RavenDB server selects the 8080 TCP/IP port if it is not already in use. And once this is done that port is fixed.
  • The path for the database directory is defined by the Raven/DataDir key. The use of ~\ indicates to start from the RavenDB root directory, in which case the path will start from the server-based directory. The default value is: ~\Database\System.
  • The Raven/AnonymousAccess key by default is set to Get and it determines what actions an anonymous user can do. You can control the access level by setting this key to one of these values; Get for read only, All for read/write, and None allows access to authenticated users only.

Launching the RavenDB server in the Console mode

When RavenDB is launched in the console mode it will open a CMD prompt window which will stay open until the user has entered one of the four available commands:

  • cls: This command is used to clear the screen
  • reset: This command is used to reset the RavenDB server
  • gc: This command is used to initiate the garbage collection
  • q: This command is used to shut down the RavenDB server and terminate the CMD prompt window