Skip to content

Ability to start (or convert) database to MDB #97

Open
@JohnOmernik

Description

@JohnOmernik

Two things, starting from scratch and using MDB files (for performance) and the option to move current HDB setups to MDB.

Thoughts?

Activity

ghost

ghost commented on Dec 12, 2016

@ghost
Collaborator

if someone can explain how to move HDB setup to MDB it would be great :)

penevigor

penevigor commented on May 4, 2017

@penevigor

Did you found solution for this? I too need to do migration from HDB to MDB

JohnOmernik

JohnOmernik commented on Jul 20, 2017

@JohnOmernik
Author

I am still looking for a sane way to do it. Most of the guides I've found require much more OpenLDAP knowledge than I currently have. If i get steps I will post here.

JohnOmernik

JohnOmernik commented on Jul 20, 2017

@JohnOmernik
Author

So I converted, now I have a smaller setup, so it may have been easier for me, but here are my steps:

  • Update start file (script that runs openldap in docker) to include env varable LDAP_BACKED: mdb
  • Go to current host running openldap, docker exec /bin/bash into it
  • run: slapcat -v -l /path/to/external/volume/dump.ldif you need to take this data out of the contianer, so make sure it exists after shutting down!
  • Then copy dump.ldif as a a saved copy (dump_saved.ldif or something)
  • Stop current openldap docker
  • cp -R ldap and slapd.d volumes (your external data) to ldap_hdb and slapd.d_hdb
  • mv ldap to ldap_old and slapd.d to slad.d_old
  • mkdir ldap and slapd.d (new empty directories)
  • Start openldap fresh, it will create a blank DB with your settings (including setting up the core dn, admin, and readonly if set)
  • edit dump.ldif to remove the first three entry blocks (dn for your base, then admin@ and readonly@ if they exist)
  • Go to host running open ldap, run slapadd -l /path/to/dump.ldif (inside of container that runing openldap)
  • Now you should be good to go!

I then created indexes everything seems to be working!

condescendent

condescendent commented on May 23, 2018

@condescendent

HI, John:

thank you for your procedure, I am converting bdb to mdb now.

I have difficulty to understand your step 6 -9.
cp -R ldap and slapd.d volumes (your external data) to ldap_hdb and slapd.d_hdb
mv ldap to ldap_old and slapd.d to slad.d_old
mkdir ldap and slapd.d (new empty directories)

Do you mean I need rename my volumes to ldap_hdb and slapd.d_hdb ? I got very confused here.
I have created two volumes as "ldap" and "slapd.d" and mounted them into /var/lib/ldap (LDAP database files) and /etc/ldap/slapd.d (LDAP config files). Do I need rename the volume or do something ?

Please help.

gitrootid

gitrootid commented on Mar 3, 2020

@gitrootid

so long ,but I search aroud, and no answer,so paste my steps here:

step 0: prepare hdb backup file: ldap-2020-03-03.ldif

mkdir -p /test/openldap/backups
cp -v ldap-2020-03-03.ldif /test/openldap/backups
tree openldap/
openldap/
└── backups
└── ldap-2020-03-03.ldif

step 1: generate config files

docker run
--name openldap
--env LDAP_TLS=false
--env LDAP_ORGANISATION="baidu"
--env LDAP_DOMAIN="baidu.com"
--env LDAP_ADMIN_PASSWORD="yourpassword"
-p 389:389
-v /test/openldap/config:/etc/ldap/slapd.d
-v /test/openldap/backups:/backups
-d osixia/openldap:1.3.0

docker stop openldap && docker rm openldap

tree openldap/
/openldap/
├── backups
│   └── ldap-2020-03-03.ldif
└── config
├── cn=config
│   ├── cn=module{0}.ldif
│   ├── cn=schema
│   │   ├── cn={0}core.ldif
│   │   ├── cn={10}quota.ldif
│   │   ├── cn={11}radius.ldif
│   │   ├── cn={12}samba.ldif
│   │   ├── cn={13}zarafa.ldif
│   │   ├── cn={1}cosine.ldif
│   │   ├── cn={2}nis.ldif
│   │   ├── cn={3}inetorgperson.ldif
│   │   ├── cn={4}ppolicy.ldif
│   │   ├── cn={5}dhcp.ldif
│   │   ├── cn={6}dnszone.ldif
│   │   ├── cn={7}mail.ldif
│   │   ├── cn={8}mmc.ldif
│   │   └── cn={9}openssh-lpk.ldif
│   ├── cn=schema.ldif
│   ├── olcBackend={0}mdb.ldif
│   ├── olcDatabase={0}config.ldif
│   ├── olcDatabase={-1}frontend.ldif
│   ├── olcDatabase={1}mdb
│   │   ├── olcOverlay={0}memberof.ldif
│   │   └── olcOverlay={1}refint.ldif
│   └── olcDatabase={1}mdb.ldif
├── cn=config.ldif
└── docker-openldap-was-admin-password-set

step 2: import backup data

docker run --rm
--name openldap
--env LDAP_TLS=false
-p 389:389
-v /test/openldap/database:/var/lib/ldap
-v /test/openldap/config:/etc/ldap/slapd.d
-v /test/openldap/backups:/backups
-d osixia/openldap:1.3.0 bash -c "slapadd -l /backups/ldap-2020-03-03.ldif"

tree openldap/
openldap/
├── backups
│   └── ldap-2020-03-03.ldif
├── config
│   ├── cn=config
│   │   ├── cn=module{0}.ldif
│   │   ├── cn=schema
│   │   │   ├── cn={0}core.ldif
│   │   │   ├── cn={10}quota.ldif
│   │   │   ├── cn={11}radius.ldif
│   │   │   ├── cn={12}samba.ldif
│   │   │   ├── cn={13}zarafa.ldif
│   │   │   ├── cn={1}cosine.ldif
│   │   │   ├── cn={2}nis.ldif
│   │   │   ├── cn={3}inetorgperson.ldif
│   │   │   ├── cn={4}ppolicy.ldif
│   │   │   ├── cn={5}dhcp.ldif
│   │   │   ├── cn={6}dnszone.ldif
│   │   │   ├── cn={7}mail.ldif
│   │   │   ├── cn={8}mmc.ldif
│   │   │   └── cn={9}openssh-lpk.ldif
│   │   ├── cn=schema.ldif
│   │   ├── olcBackend={0}mdb.ldif
│   │   ├── olcDatabase={0}config.ldif
│   │   ├── olcDatabase={-1}frontend.ldif
│   │   ├── olcDatabase={1}mdb
│   │   │   ├── olcOverlay={0}memberof.ldif
│   │   │   └── olcOverlay={1}refint.ldif
│   │   └── olcDatabase={1}mdb.ldif
│   ├── cn=config.ldif
│   └── docker-openldap-was-admin-password-set
└── database
├── data.mdb
└── lock.mdb

step 3: finally,fire openldap

docker run
--name openldap
--env LDAP_TLS=false
--env LDAP_ORGANISATION="baidu"
--env LDAP_DOMAIN="baidu.com"
--env LDAP_ADMIN_PASSWORD="yourpassword"
-p 389:389
-v /test/openldap/database:/var/lib/ldap
-v /test/openldap/config:/etc/ldap/slapd.d
-v /test/openldap/backups:/backups
-d osixia/openldap:1.3.0

step 4:tested

test with confluence, works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @JohnOmernik@penevigor@condescendent@gitrootid

        Issue actions

          Ability to start (or convert) database to MDB · Issue #97 · osixia/docker-openldap