Book Image

RavenDB 2.x Beginner's Guide

By : Khaled Tannir
Book Image

RavenDB 2.x Beginner's Guide

By: Khaled Tannir

Overview of this book

RavenDB is a second generation document database written in .NET, offering a flexible data model designed to address requirements coming from real-world systems. It is different from the other document databases around, as with RavenDB you can get up and running in a few minutes, and that includes grasping all the basics. It allows you to build high-performance, low-latency applications with ease and efficiency.RavenDB 2.x Beginner's Guide introduces RavenDB concepts and teaches you everything, right from installing RavenDB, to creating documents, and querying indexes. This book will help you take advantage of powerful, document-oriented NoSQL databases and build a solid foundation on which you can create your .NET applications. This book presents RavenDB, the .NET document-oriented NoSQL database, through a series of clear and practical exercises that will help you to take advantage of this database server. The book starts off with an introduction to RavenDB and its Management Studio. You will then move ahead and learn how to quickly and efficiently build high performance, NoSQL document-oriented .NET applications using the .NET client API or the HTTP REST API. Next, Dynamic and static indexes that use map/reduce to process datasets are covered. You will then see how to create and query these indexes, with the help of detailed examples. You will also learn how to deploy your RavenDB server in a production environment and how to optimize and secure it.With numerous practical examples, RavenDB 2.x Beginner's Guide teaches you everything you need to know for building high performance .NET document-oriented NoSQL databases.
Table of Contents (21 chapters)
RavenDB 2.x Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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