How to reset Listener / Notifier replication


#1

Problem

In case severe inconsistency or corruption has be detected for the translog file we recommend to reset the replication for all systems in the domain. Please note that this is a major operation and will induce temporary downtimes for all services in the UCS domain.

These steps described in this article only apply to you, if you are sure, that the LDAP replication in your UCS domain has severe inconsistencies. Make sure to first follow the analysis described in


before continuing with this article.

Solution

Step 1: Reset LDAP transaction status on the UCS Master

As a first step, stop the LDAP-Server slapd,univention-directory-notifier and univention-directory-listener on all servers by logging in as root on each server and running

service slapd stop
service univention-directory-notifier stop
service univention-directory-listener stop

On Member servers there is only the listener running.

On the UCS Master run the following commands to reset the replication counters:
Note: You might download the script univention-reset-replication-counters.py (1,0 KB)
and start it with python univention-reset-replication-counters.py.

python -c "
#!/usr/bin/python
from os import stat, unlink
from subprocess import Popen, PIPE
from univention.config_registry import ConfigRegistry
ucr = ConfigRegistry()
ucr.load()

p = Popen(['/usr/sbin/univention-directory-listener-dump', '-i'], stdout=PIPE)
stdout, stderr = p.communicate()
lid = int(stdout.split()[0])

nid = lid
last_id = lid
if stat('/var/lib/univention-ldap/listener/listener').st_size != 0:
    with open('/var/lib/univention-ldap/listener/listener') as f:
        first = f.readline()
        nid, tail = first.split(' ', 1)
        nid = int(nid)
        dn, opcode = tail.rsplit(' ', 1)
        for line in f:
            pass
        last_id, tail = line.split(' ', 1)
        last_id = int(last_id)
        dn, opcode = tail.rsplit(' ', 1)

with open('/var/lib/univention-ldap/notify/transaction', 'w') as f:
    for id in xrange(lid, nid):
        f.write('%d %s m\n' % (id, ucr['ldap/base']))

with open('/var/lib/univention-ldap/last_id', 'w') as f:
    f.write(str(last_id))

unlink('/var/lib/univention-ldap/notify/transaction.index')
"

After this, the services need to be started again:

service slapd start
service univention-directory-notifier start
service univention-directory-listener start

Step 2: Rejoin all systems

Next all other UCS servers need to be joined again. It is a good idea to start re-joining with the UCS Backup systems in the domain and continue with UCS Slave and Memberserver systems. On all system roles this can be achieved by running univention-join.