将ldif文件导入OpenLDAP服务器

将ldif文件导入OpenLDAP服务器,ldap,openldap,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 d

我刚刚安装了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
#允许LDAPv2绑定
允许绑定_v2
#允许LDAPv2绑定
#允许绑定_v2
#这是主slapd配置文件。更多信息请参见slapd.conf(5)
#有关配置选项的信息。
#######################################################################
#全球指令:
#允许的特征
#允许绑定_v2
模块路径/usr/lib/ldap
模块加载后\u hdb
#模数负载引用
#模块负载rwm
#模式和对象类定义
包括/etc/ldap/schema/core.schema
include/etc/ldap/schema/cosine.schema
包括/etc/ldap/schema/nis.schema
包括/etc/ldap/schema/inetorgperson.schema
包括/etc/ldap/schema/openldap.schema
#模式检查允许强制输入项
#为其对象类的
#计划取消
#放置pid文件的位置。init.d脚本
#如果更改此项,将不会停止服务器。
pidfile/var/run/slapd/slapd.pid
#传递给服务器的参数列表
args文件/var/run/slapd/slapd.args
#读取slapd.conf(5)以获取可能的值
#日志级别65389
#######################################################################
#bdb的特定后端指令:
#特定于后端的指令将应用于此后端,直到另一个后端
#出现“backend”指令
后端hdb
#######################################################################
#“其他”的特定后端指令:
#特定于后端的指令将应用于此后端,直到另一个后端
#出现“backend”指令
#后端
#######################################################################
#bdb型数据库#1的具体指令:
#特定于数据库的指令将应用于此数据库,直到另一个
#出现“database”指令
数据库hdb
#数据库#1中目录的基
后缀“dc=tpw,dc=uca,dc=ma”
检查点512 30
rootdn“cn=Manager,dc=tpw,dc=uca,dc=ma”
rootpw“admin”
#数据库#1的数据库文件的物理存储位置
目录“/var/lib/ldap”
#数据库#1的索引选项
索引对象类eq
指数
指数
#为数据库#1节省修改条目的时间
拉斯莫顿
#存储数据库#1的副本日志的位置
#replogfile/var/lib/ldap/replog
#默认情况下,用户密码可以更改
#通过拥有它的条目(如果它们经过身份验证)。
#其他人不应该看到它,除了
#下面的管理员条目
#这些访问线仅适用于数据库#1
访问attrs=userPassword
通过dn=“cn=Manager,dc=tpw,dc=uca,dc=ma”写入
匿名授权
自编
没有
#确保对诸如
#支持SASLME机制。没有这个你可以
#在不知道什么的情况下与SASL有问题
#机制是可用的等等。
#请注意,“访问*”中包含了这一点
#ACL也在下面,但如果您将其更改为“人”
#你已经习惯了,如果你
#希望SASL(以及其他可能的东西)发挥作用
#很高兴。
通过*读取访问dn.base=”“
#管理员dn对其他所有人都具有完全写访问权限
#我什么都能看。
获取*
通过dn=“cn=Manager,dc=tpw,dc=uca,dc=ma”写入
按*读
#对于Netscape漫游支持,每个用户都可以获得一次漫游
#对其具有写访问权限的配置文件
#访问dn=“*,ou=Roaming,o=morsnet”
#通过dn=“cn=Manager,dc=localdomain”写入
#by dnattr=所有者写入

如何解决此问题?

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

是否有方法导入ldif以覆盖用户和密码?