RavenDB Notes

A few notes from my personal exploration of RavenDB so far.

Under-The-Hood

  • Document database part of the NoSQL database offerings.
  • Is transactional.
  • Open source.
  • Written in .NET and required .NET Framework 4.0.
  • Data is stored as a schema-less JSON document.
  • From .NET it can be queried using LINQ.
  • Indexes are automatically created based on usage though can be specified by the consumer.
  • Two storage engines are supported called Esent and Munin though only Esent is supported for a production environment.
  • A single data entry is called a 'Document'.
  • Each document has MetaData attached to it by default which contains information that is used internally by RavenDB.
  • A 'Collection' is a set of documents sharing the same RavenDB entity type. This is only a logical/ virtual construct.
  • Each document has it's own unique global ID. Reusing the same ID will overwrite the existing document.
  • 'RavenDB Management Studio' is the RavenDB equivalent to SSMS. Uses MapReduce in the background and indexes are running asynchronously.
  • RavenDB 3.0 should be able to run on Mono.

Safe By Default

  • Result set limits (Unbounded result sets)
    • Failing to specify the page size on the client (using Take() method) will default to a 128 page size.
    • On the server side, page sizes greater than 1024 will be reduced to 1024.
    • The server side limit can be adjusted using Rave/MaxPageSize though this action isn't recommended.
  • Excessive querying (Unbounded number of requests)
    • Number of requests from each clients session is limited to 30 by default.
    • Any queries over this limit will throw an exception.
    • This limit can be overwritten on by either a global limit or per client session.

Consumption

  • RavenDB can be consumed / connected to using one of two methods.
    • .NET Client API - Recommend were ever possible
    • HTTP API
  • TO BE FLESHED OUT

Index Administration

  • Resetting an index is usually needed if the error quota has been reached and the index has been taken offline. This can be achieved in three ways:
  • An index can be deleted using one of these three methods:
  • Index locking can be used to prevent tampering. The three index locking modes are:
    • Unlock
    • LockedIgnore
    • LockedError
  • Indexing priorities can be set.
  • Auto indexes can be persisted to disk.

Backup And Restore

  • A backup can be triggered using two methods:
    • The url must be that of the database. Point it at the root will backup the system database - Raven.Backup.exe --url=http://localhost:8080/ --dest=C:TempFoo
    • curl -X POST http://localhost:8080/admin/backup -d "{ 'BackupLocation': 'C:\Backups\2010-05-06' }"
  • To restore a database you need to use the Raven.Server.Exe - Raven.Server.exe -src [backup location] -dest [restore location] -restore
  • If restoring to an existing data directory, you will need to first remove all data files.
  • Backups are async and restores are fully sync.

Posted in Databases, Databases with : Notes