To setup a master-slave replication, this is to replicate documents from one database to another, we need to have two databases (they can be on the same or different servers). For our purposes, we will create two separate servers. The first one will be our master server and will run on port 8081. The second one, the slave server, will run at 8082 port.
Configuring a master server
- first, we need to have a database that we want to replicate to another server. This database must have a replication bundle enabled. Let's call it
- to setup replication, we need to go to our Replication Settings View and add new replication destination using the
Add destination button. Here we need to provide information such as the URL of the destination server (
http://localhost:8082/) and the name of the database there (
- you will notice that two documents have been created. The first one is called
Raven/Replication/Destinations, and you will find your replication configuration there. The second document is called
Raven/Replication/Destinations/localhost8082databasesNorthwind-Backup and it has been created because RavenDB detected a problem with replicating documents to slave, which is expected because we haven't configured it yet.
Configuring a slave server
- there is only one step here: you need to create a database with replication bundle turned on.
- on the slave server go to Documents View and, if all went well, all documents from the master server should be there. Note that replication process might take some time.