[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: slapcat -n 0 and slapadd



On Oct 26, 2011, at 1:13 PM, Howard Chu wrote:

> Craig White wrote:
>> 
>> On Oct 26, 2011, at 12:00 PM, Howard Chu wrote:
>> 
>>> Craig White wrote:
>>>> Having migrated to dynamic config, I'm looking for a reasonable way to
>>>> restore in the event of a disaster.
>>>> 
>>>> The discussion last week got me curious and though I can slapcat -n 0 -l
>>>> $SOME_FILE I can't slapadd this same file because it complains that I don't
>>>> have a slapd.conf file, which of course is true... I haven't needed it with
>>>> the dynamic configuration backend.
>>>> 
>>>> What's the minimum that I would need in a slapd.conf file so I can simply
>>>> 'rm -fr /var/lib/ldap/*&&   slapadd -l $SLAPD_BACKUP' ?
>>> 
>>> You don't need a slapd.conf file at all. You just need to tell it where to slapadd the configuration.
>>> 
>>> slapadd -F new/slapd.d -n0 config.ldif
>> ----
>> # mkdir /etc/ldap/slapd.d
>> 
>> # slapadd -l slapcat_config.ldif -F /etc/ldap/slapd.d
>> Available database(s) do not allow slapadd
>> 
>> There aren't any databases configured because I'm thinking recovery from a disaster, starting from a clean install as it were.
> 
> Pay attention. Even a monkey can copy text without omitting parts.
> 
> slapadd -F /etc/ldap/slapd.d -n 0 -l slapcat_config.ldif
----
sorry - I'm stupid but and am not a monkey.

It seems to me the reason that something like Zytrax gets traction is sometimes the seemingly very simple just doesn't work and then of course, there is the public chastisement that seemingly comes with the territory. All I am trying to do is have a disaster plan though admittedly, I can do pretty much the same because I have a scripted installation which I can use to set up the configuration again and just ldapadd (possibly slapadd) the main DSA data. This was something I could do easily with a flat file configuration but dynamic configuration has made this a real chore.

blow by blow... (have done slapcat -n 0 & -n 1 from my production machine and am working on a VM test, certificate names & paths have been fixed for the VM and adjustments made for apparmor)

root@ubuntu:/etc/ldap# rm -fr slapd.d/*
root@ubuntu:/etc/ldap# rm -fr /var/lib/ldap/*
root@ubuntu:/etc/ldap# slapadd -F /etc/ldap/slapd.d -n 0 -l slapcat_config.ldif
olcDbDirectory: value #0: invalid path: No such file or directory
slapadd: could not add entry dn="olcDatabase={2}hdb,cn=config" (line=1009): 
_###################   99.24% eta   none elapsed            none spd   5.4 M/s 
Closing DB...
root@ubuntu:/etc/ldap# slapadd -F /etc/ldap/slapd.d -n 1 -l slapcat_data.ldif
accesslog: "logdb <suffix>" missing or invalid.
backend_startup_one (type=hdb, suffix="dc=ttinet,dc=local"): bi_db_open failed! (1)
slap_startup failed

line 1009 in my slapcat_config.ldif...
dn: olcDatabase={2}hdb,cn=config

but just above that line is the section...
dn: olcOverlay={1}accesslog,olcDatabase={1}hdb,cn=config
objectClass: olcOverlayConfig
objectClass: olcAccessLogConfig
olcOverlay: {1}accesslog
olcAccessLogDB: cn=accesslog
olcAccessLogOps: writes
olcAccessLogPurge: 07+00:00 01+00:00
olcAccessLogSuccess: TRUE
structuralObjectClass: olcAccessLogConfig
entryUUID: 676a8df4-6db8-1030-90ba-11b63c1d4648
creatorsName: cn=admin,cn=config
createTimestamp: 20110907161553Z
entryCSN: 20110907161553.355785Z#000000#000#000000
modifiersName: cn=admin,cn=config
modifyTimestamp: 20110907161553Z