Force resync after 1 Container was down
Hello,
i built the Master-Master replication with this guide. Works so far. My problem is. When i stop and restart one of the container they will not sync anymore. I tried deploying a new container. Does not work I tried deleting the database and deploying new container. Does not work.
in the restartet one i get errors like
56b0536d slap_client_connect: URI=ldap://ldap2.pxr.de Error, ldap_start_tls failed (52) 56b0536d do_syncrepl: rid=102 rc 52 retrying
The still running one says:
56b056e7 null_callback : error code 0x50 56b056e7 syncrepl_entry: rid=001 be_modify failed (80) 56b056e7 do_syncrepl: rid=001 rc 80 retrying 56b05700 conn=1055 fd=21 ACCEPT from IP=xx.xx.xx.xx:48892 (IP=172.17.0.2:389) 56b05700 conn=1055 op=0 EXT oid=1.3.6.1.4.1.1466.20037 56b05700 conn=1055 op=0 STARTTLS 56b05700 conn=1055 op=0 RESULT oid= err=52 text=Could not initialize TLS 56b05700 conn=1056 fd=23 ACCEPT from IP=xx.xx.xx.xx:48893 (IP=172.17.0.2:389) 56b05700 conn=1056 op=0 EXT oid=1.3.6.1.4.1.1466.20037 56b05700 conn=1056 op=0 STARTTLS 56b05700 conn=1056 op=0 RESULT oid= err=52 text=Could not initialize TLS 56b05700 conn=1055 op=1 UNBIND 56b05700 conn=1055 fd=21 closed 56b05700 conn=1056 op=1 UNBIND 56b05700 conn=1056 fd=23 close
The only way to get replication working again, is to completly delete both container and databases and start new ones.
There must be a way to get them sync again without desstroying the entire database.
I found something like. "start slapd with -c and the rid" But how do i restart the slapd process when i am in the container?
Any help would be nice.
Hello, this is a TLS error, so i guess there is a missconfiguration of TLS certificates.
Make sure to start containers with --hostname ldap1.pxr.de and ldap2.pxr.de If you use your own certificates each container must get the corresponding certificate with the right cn. If you use the self generated one this should be ok, by default the generated certificate use the container hostname.
Then check that ldap1.pxr.de and ldap2.pxr.de routes to the right container IP.
If you use "fake" hostnames and manually edit /etc/hosts like in the example. On container restart docker reset the container /etc/hosts file so you must re-edit that file each time... So for a real world working solution you must route ldap1.pxr.de and ldap2.pxr.de to the right container IP.
This can be tricky because docker may change container IP on container restart, personnally i use kubernetes services to get ride of this problem but docker swarm should do the trick too.
I have the exact same problem, and twice and triple checked but the rights to the certificates are OK. Also i can see them using openssl s_client -connect <ldaphost>:636.
# vim: set ts=2 sw=2 expandtab filetype=yaml
version: '2'
services:
ldap1:
hostname: ldap1
image: osixia/openldap:1.1.11
environment:
- LDAP_OPENLDAP_GID=998
- LDAP_OPENLDAP_UID=998
- LDAP_TLS=true
- LDAP_REPLICATION=true
- LDAP_REPLICATION_HOSTS=#PYTHON2BASH:['ldap://ldap1','ldap://ldap2']
- LDAP_TLS_CRT_FILENAME=ldap1.crt
- LDAP_TLS_KEY_FILENAME=ldap1.key
- LDAP_TLS_CA_CRT_FILENAME=ca.crt
- LDAP_ORGANISATION=myorg
- LDAP_DOMAIN=myorg.lan
- LDAP_ADMIN_PASSWORD=banaan
- LDAP_TLS_VERIFY_CLIENT=never
volumes:
- ldap1_config:/etc/ldap/slapd.d
- ldap1_data:/var/lib/ldap
- /home/myuser/src/compose/openldap/ldap1certs/ldap1.crt:/container/service/slapd/assets/certs/ldap1.crt
- /home/myuser/src/compose/openldap/ldap1certs/ldap1.key:/container/service/slapd/assets/certs/ldap1.key
- /home/myuser/src/compose/openldap/ldap1certs/ca.crt:/container/service/slapd/assets/certs/ca.crt
command:
- "--loglevel"
- "debug"
- "--copy-service"
ldap2:
hostname: ldap2
depends_on:
- ldap1
image: osixia/openldap:1.1.11
environment:
- LDAP_OPENLDAP_GID=998
- LDAP_OPENLDAP_UID=998
- LDAP_TLS=true
- LDAP_REPLICATION=true
- LDAP_REPLICATION_HOSTS=#PYTHON2BASH:['ldap://ldap1','ldap://ldap2']
- LDAP_TLS_CRT_FILENAME=ldap2.crt
- LDAP_TLS_KEY_FILENAME=ldap2.key
- LDAP_TLS_CA_CRT_FILENAME=ca.crt
- LDAP_ORGANISATION=myorg
- LDAP_DOMAIN=myorg.lan
- LDAP_ADMIN_PASSWORD=banaan
- LDAP_TLS_VERIFY_CLIENT=never
volumes:
- ldap2_config:/etc/ldap/slapd.d
- ldap2_data:/var/lib/ldap
- /home/myuser/src/compose/openldap/ldap2certs/ldap2.crt:/container/service/slapd/assets/certs/ldap2.crt
- /home/myuser/src/compose/openldap/ldap2certs/ldap2.key:/container/service/slapd/assets/certs/ldap2.key
- /home/myuser/src/compose/openldap/ldap2certs/ca.crt:/container/service/slapd/assets/certs/ca.crt
command:
- "--loglevel"
- "debug"
- "--copy-service"
phpldapadmin:
hostname: phpldapadmin
image: osixia/phpldapadmin
environment:
- PHPLDAPADMIN_LDAP_HOSTS=#PYTHON2BASH:[{'ldap1':[{'login':[{'bind_id':'cn=admin,dc=myorg,dc=lan'},{'bind_pass':'banaan'}]}]},{'ldap2':[{'login':[{'bind_id':'cn=admin,dc=myorg,dc=lan'},{'bind_pass':'banaan'}]}]}]
ports:
- 6443:443
volumes:
ldap1_config:
ldap1_data:
ldap2_config:
ldap2_data:
Is there any progress on this?
Same situation met, after one container stopped, the sync doesn't work any more after recover the container with the host set in the failed one, no error appears in log