Exporting and Importing data with RavenDB

I was wondering how I would go above upgrading from one build version of RavenDB (build 701) to a newer version of RavenDB (build 888) and decided to find out how.

As it turns out like most things in RavenDB its very easy! – the following is how to go about upgrading from one version of RavenDB to another.

Note:- You can do it this way and this is the recomended way here however I wanted to try doing it using importing and exporting the data.

Please not that this was done on my local dev machine at work and not done in a production environment, it wont cover replication as well as some other things to think about but its covers the basics.

I have RavenDB build 701 running from d:\ravedb-build\701 which runs on http://localhost:8080, I then added some test documents to the default database.

I noticed RavenDB had been updated to Build 888 and I began to think how do I get the data out of the old build version and into the new version, having a quick look I soon realised that I need to export data from the 701 build and then import that data into the 888 build.

Here is how I went about it:-

  1. I have RavenDB build 701 running from c:\ravendb\RavenDB-Build-701\ and had 50 documents within it – this runs from http://localhost:8080 as seen below:- Raven Build 701
  2. I then downloaded RavenDB build 888 and ran that from d:\RavenDB-Build-888\ which was empty – this runs from http://localhost:8082 as seen below:- Raven Build 888
  3. Now we can see the differences in the document database as below, Raven 701 build with documents:-
    701 Studio
  4. And the Raven 888 build with no documents as yet:-
    888 Studio
  5. To export and import data within RavenDB you use a tool called smuggler, smuggler can be found within the Smuggler folder and the exe is called Raven.Smuggler.exe
  6. To export the data from RavenDB Build 700 I went into a command prompt window moved into the location of the smuggler exe and ran the following command -> Raven.Smuggler out http://localhost:8080 dump.raven
    Dump of 701
  7. Ok great, now we have exported our data, time to import it into the newer 888 build of RavenDB, to do this we need to a couple of things, firstly locate the dump.raven file in the 701 build/smuggler folder as below:-

    701 dump file location

    And then copy it to somewhere for importing, to make it easy I just copied it to the smuggler folder within the build 888 as below:-

    888 dump file location

    Then go to the smuggler folder for this build and then use the following command -> Raven.Smuggler in http://localhost:8082 dump.raven

  8. We will see Raven ha imported our documents for us:- Data Imported
  9. Lastly lets check in the new build 888 that our documents are there:-
    Documents Imported

And there we go we have moved out documetns from the 701 build to the 888 build, if yo do this you will notice that the index definitions are copied there but havent been built, i.e. youll need to rubuild them manually.

Please feel free to leave a comment if you find this useful or have any questions.