将ldif文件导入OpenLDAP服务器

时间:2014-05-07 09:40:33

标签: ldap openldap

我刚刚安装了OpenLDAP,我正在尝试将ldif文件导入到我的LDAP服务器,但是我收到此消息错误:

5369fd49 hdb_db_open: database "dc=04": database already in use.
5369fd49 backend_startup_one (type=hdb, suffix="dc=04"): bi_db_open failed! (-1)
slap_startup failed

这是我的ldif文件:

dn:dc=tpw,dc=uca,dc=ma
dc: uca
objectClass: dcObject
objectClass: top
objectClass: domain
structuralObjectClass: domain
entryUUID: 1857816a-1f80-1032-852e-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312164613Z
entryCSN: 20130312164613.519557Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312164613Z

dn: ou=people,dc=tpw,dc=uca,dc=ma
ou: people
objectClass: organizationalUnit
objectClass: top
structuralObjectClass: organizationalUnit
entryUUID: 2d4d29b2-1f80-1032-852f-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312164648Z
entryCSN: 20130312164648.683888Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312164648Z

dn: ou=groupes,dc=tpw,dc=uca,dc=ma
ou: groupes
objectClass: organizationalUnit
objectClass: top
structuralObjectClass: organizationalUnit
entryUUID: 42a4d12a-1f80-1032-8530-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312164724Z
entryCSN: 20130312164724.490529Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312164724Z

dn: uid=admin,ou=people,dc=tpw,dc=uca,dc=ma
uid: admin
sn: Admin
cn: Admin
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
structuralObjectClass: inetOrgPerson
entryUUID: 6b1ddf48-1f80-1032-8531-4da7bdf172d2
creatorsName: cn=Manager,dc=uca,dc=ma
createTimestamp: 20130312164832Z
userPassword:: e1NIQX0wRFBpS3VOSXJyVm1EOElVQ3V3MWhReE5xWmM9
mail: admin@uca.ma
givenName: admin
entryCSN: 20130312165133.498240Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312165133Z

dn: cn=GI,ou=groupes,dc=tpw,dc=uca,dc=ma
uniquemember: uid=admin,ou=people,dc=tpw,dc=uca,dc=ma
cn: GI
objectClass: groupOfUniqueNames
objectClass: top
structuralObjectClass: groupOfUniqueNames
entryUUID: a165e4ec-1f80-1032-8532-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312165003Z
entryCSN: 20130312165003.461713Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312165003Z

dn: cn=GP,ou=groupes,dc=tpw,dc=uca,dc=ma
uniquemember: uid=admin,ou=people,dc=tpw,dc=uca,dc=ma
cn: GP
objectClass: groupOfUniqueNames
objectClass: top
structuralObjectClass: groupOfNames
entryUUID: aaf44eb8-1f80-1032-8534-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312165019Z
entryCSN: 20130312165019.494529Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312165019Z

dn: cn=GT,ou=groupes,dc=tpw,dc=uca,dc=ma
uniquemember: uid=admin,ou=people,dc=tpw,dc=uca,dc=ma
cn: GT
objectClass: groupOfUniqueNames
objectClass: top
structuralObjectClass: groupOfNames
entryUUID: b09d6660-1f80-1032-8536-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312165028Z
entryCSN: 20130312165028.991299Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312165028Z

这是我的slapd.conf文件:

# Allow LDAPv2 binds
allow bind_v2

# Allow LDAPv2 binds
# allow bind_v2

# This is the main slapd configuration file. See slapd.conf(5) for more
# info on the configuration options.

#######################################################################
# Global Directives:

# Features to permit
#allow bind_v2


modulepath      /usr/lib/ldap
moduleload back_hdb
#moduleload refint
#moduleload rwm

# Schema and objectClass definitions
include         /etc/ldap/schema/core.schema
include         /etc/ldap/schema/cosine.schema
include         /etc/ldap/schema/nis.schema
include         /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/openldap.schema



# Schema check allows for forcing entries to
# match schemas for their objectClasses's
#schemacheck     off

# Where the pid file is put. The init.d script
# will not stop the server if you change this.
pidfile         /var/run/slapd/slapd.pid

# List of arguments that were passed to the server
argsfile        /var/run/slapd/slapd.args

# Read slapd.conf(5) for possible values
#loglevel        65389


#######################################################################
# Specific Backend Directives for bdb:
# Backend specific directives apply to this backend until another
# 'backend' directive occurs
backend     hdb

#######################################################################
# Specific Backend Directives for 'other':
# Backend specific directives apply to this backend until another
# 'backend' directive occurs
#backend        <other>

#######################################################################
# Specific Directives for database #1, of type bdb:
# Database specific directives apply to this databasse until another
# 'database' directive occurs
database        hdb

# The base of your directory in database #1
suffix          "dc=tpw,dc=uca,dc=ma"
checkpoint 512 30
rootdn      "cn=Manager,dc=tpw,dc=uca,dc=ma"
rootpw      "admin"



# Where the database file are physically stored for database #1
directory       "/var/lib/ldap"

# Indexing options for database #1
index           objectClass eq
index       cn eq
index       ou eq

# Save the time that the entry gets modified, for database #1
lastmod         on

# Where to store the replica logs for database #1
# replogfile    /var/lib/ldap/replog

# The userPassword by default can be changed
# by the entry owning it if they are authenticated.
# Others should not be able to see it, except the
# admin entry below
# These access lines apply to database #1 only
access to attrs=userPassword
        by dn="cn=Manager,dc=tpw,dc=uca,dc=ma" write
        by anonymous auth
        by self write
        by * none

# Ensure read access to the base for things like
# supportedSASLMechanisms.  Without this you may
# have problems with SASL not knowing what
# mechanisms are available and the like.
# Note that this is covered by the 'access to *'
# ACL below too but if you change that as people
# are wont to do you'll still need this if you
# want SASL (and possible other things) to work 
# happily.
access to dn.base="" by * read

# The admin dn has full write access, everyone else
# can read everything.
access to *
        by dn="cn=Manager,dc=tpw,dc=uca,dc=ma" write
        by * read

# For Netscape Roaming support, each user gets a roaming
# profile for which they have write access to
#access to dn=".*,ou=Roaming,o=morsnet"
#        by dn="cn=Manager,dc=localdomain" write
#        by dnattr=owner write

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

看起来您正在尝试使用slapadd导入LDIF时运行LDAP服务。关闭LDAP,再试一次。