
OpenLDAP Master Slave Replication In A Minute
Often I have seen that OpenLDAP Master Slave Replication seems heavy job for server administrators. Many articles are available to achieve this scenario but majority of the articles are so detailed that mostly administrators gets confused about their replication.
Many time they applies replication configuration on server but loses data on either server or sometime whole database. Or gets locked out from database where they are not able to recover data.
Many time, I also have made mistakes in learning OpenLDAP Master Slave Replication on my test servers, but just to understand and learn the whole process. Here is how you can achieve OpenLDAP Master Slave Replication in just a minute.
class="eltd-blockquote-shortcode" style="width: 80%" >OpenLDAP Version 2.4++ Recommended - You may try earlier versions also
Always take backup of your OpenLDAP database before proceeding. Always try out on test servers instead directly applying on production server
Applied on CentOS Linux release 7.2.1511 (Core)
Apply on Master OpenLDAP Server:
Edit /etc/openldap/slapd.conf file with your favorite text editor with ROOT access on the server. (My favorite VI editor)
vi /etc/openldap/slapd.conf
Once you open slapd.conf file go to end of the file. (Press Shift + g in VI editor to go to end of the file) Now paste below code at the end of the file.
moduleload syncprov
index entryCSN,entryUUID eq
overlay syncprov
syncprov-checkpoint 100 10
syncprov-sessionlog 200
Save your file (hit :wq and enter key to save and exit file)
Apply on Slave OpenLDAP Server:
Edit /etc/openldap/slapd.conf file with your favorite text editor with ROOT access on the server. (My favorite VI editor)
vi /etc/openldap/slapd.conf
Once you open slapd.conf file go to end of the file. (Press Shift + g in VI editor to go to end of the file) Now paste below code at the end of the file.
syncrepl rid=001
provider=ldap://192.168.1.1:389
searchbase="dc=iredmail,dc=kom"
bindmethod=simple
binddn="cn=vmail,dc=iredmail,dc=kom"
credentials=your binddn password
schemachecking=on
type=refreshOnly
retry="60 +"
scope=sub
interval=00:00:10:00
attrs="*,+"
Save your file (hit :wq and enter key to save and exit file)
On Slave server you need to change following as per your Master OpenLDAP Server configuration.
All above parameters can easily be available from your system / database administrator or slapd.conf file of your Master OpenLDAP server. (Credentials must be provided as this will not be available in your Master server’s slapd.conf)
You can use slappasswd utility if you would like to assign new password. Check slappasswd reference guide here
Restart OpenLDAP service on Master and Slave server by issuing following command.
systemctl restart slapd
You are done with OpenLDAP Master Slave Replication now. Just check or monitor /var/log/openldap.log file on both server to detect any issues with replication.
You also need to allow ports on firewall so that server allows communication over port 389.
On Primary server:
firewall-cmd --permanent \
--zone=iredmail \
--add-rich-rule='rule family="ipv4" source address="192.168.1.2/24" port protocol="tcp" port="389" accept'
On Secondary server:
firewall-cmd --permanent \
--zone=iredmail \
--add-rich-rule='rule family="ipv4" source address="192.168.1.1/24" port protocol="tcp" port="389" accept'
firewall-cmd --complete-reload
Change your respective server’s IP addresses while allowing traffic on firewall.
Runs enterprise networks and security for a living, and writes Shore Up to turn two decades of hands-on Linux, Windows and mail-server work into guides you can actually use.
More about the author →Was this article helpful?
Tap a star — no sign-in needed.
Be the first to rate this article.
Related guides
Two way Dovecot Server Replication / Mirroring
Here is step-by-step guide to achieve two way Dovecot server replication / mirroring. I had been searching a lot to achieve two way dovecot server replication / mirroring and had been trying out many things. None methods were giving me sure shot and performance intensive results. Well you all do is, play with it more to understand it more and achieve more. This is what I did and achieved what I needed. Sharing with you all that what configuration I made with my both live production servers which are now replicating each and every emails with each other. I have not received any single email replication related issue since last 2 years. And still it is…
Whitelist or Blacklist per IP on Zimbra Server – Batch File
Are you getting many spam requests from IP addresses? Do you want to block or allow IPs instantly? It’s been one hectic task for Email Administrators when they need to manage IP based whitelist and blacklist. Well here is the hassle free solution…!!! Check out my other Zimbra Batch files: Zimbra User Management Zimbra Group / Distribution Lists Management You will have to apply and modify some of the changes to get this work for you on your Zimbra Open Source Collaboration Server. Here is the guide that you need to follow first before going further below. Click HERE I believe you have changed your…
Zimbra Group Management – Batch File
My another batch file to manage Groups or Distribution lists on Zimbra server from your Windows PC. Check out my Zimbra User Management – Batch File : HERE Find our more information about Zimbra here – Zimbra Collaboration Open Source Edition It is very simple batch file, just to achieve three simple activities from Zimbra Group Management – Batch File using SSH from any windows PC: Create Distribution List Add Member to Group List Remove member from Group Here are the basic requirements that you need when you use this batch file: Install PUTTY on your windows PC where you will be using this batch file. (Get PUTTY –…
Zimbra User Management – Batch File
Everybody loves Zimbra. The best in class Zimbra Collaboration Open Source Email server with contacts, tasks and calendar management on your finger tips. I indeed love it and recommend it to small and medium businesses when they ask me how can we achieve best in-house Email server. Even many big data enterprises are also using this feature rich daemon. Find our more information about Zimbra here – Zimbra Collaboration Open Source Edition System / email administrators manages users from Zimbra Admin Panel where they can create / modify and delete users and do many things. However I find it quite lazy myself when administering users using Zimbra Admin Panel. Believe me, login on to Zimbra Admin panel, issuing…




