Monday, February 28, 2011

Configure OpenDS for Replication

I was configuring OpenDS for an customer and was very surprise how easy is to configure replications for it. Basically we do have Master and Slave machine. The Slave machine will be the one where the data will be replicated. Regarding the OpenDS documentation you can configure the replication when you install your OpenDS LDAP Server but you can do it also when you have two separated stand-alone machines. In our case we have host1 which is going to be our master LDAP Server and then we install on host2 as second stand-alone OpenDS Server which we will use as a slave. To create the replication between them we did the following:

  • very first important thing to know, the base DN has to be created on the two machines. For example if you have on host1 the base DN dc=example,dc=unit,dc=com and you want to replicate it, then go on host2 and create a new base DN with exact the same name
  • now as next you have to allow the replications on those two machines

This code will enable the replications on the two servers and fix which base DN needs to be replicated

1 ./dsreplication enable --host1 --port1 4444 --bindDN1 "cn=admin" --bindPassword1 password --replicationPort1 8989 --host2 --port2 4444 --bindDN2 "cn=admin" --bindPassword2 password --replicationPort2 8989 --adminUID admin --adminPassword password --baseDN "dc=example,dc=unit,dc=com" -X -n

  • when you finish with the command above you do need to initialize the data between the servers:

1 ./dsreplication initialize --baseDN "dc=example,dc=unit,dc=com" --adminUID admin --adminPassword password --hostSource --portSource 4444 --hostDestination --portDestination 4444 -X -n

  • now the main job is done. You can check the status of the replications:

1 ./dsreplication status -h -p 4444 --adminUID admin --adminPassword password -X

Using this now you have master to slave server. All data and schemas from the host1 will be automatically replicated to host 2. You can test it by making some changes on host1 and check if after a few seconds you can see the modification also on the slave machine.

1 comment:

  1. AnonymousMay 27, 2011

    OpenDS uses multi-master replication instead of master-slave replication, so you can change data on host2 and it will be replicated to host1.