免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4558 | 回复: 4
打印 上一主题 下一主题

[ldap] LDIF export/import问题请教 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-13 23:54 |只看该作者 |倒序浏览
正在将已经运行几年的OPENLDAP 2.0.27升级到2.3.32,升级过程中遇到一些问题向大家请教。

LDAP的结构如附图所示,其中每个RCCD是一个用户的记录,系统中有几万个用户。现在使用LDAP BROWSER 2.8.1从OPENLDAP 2.0.27中将数据EXPORT到LDIF中,然后再IMPORT到新版本的2.3.32中。
按图示的LDAP结构,在EXPORT产生的LDIF中应该是先有

dn: RCCD=AAA3140003t,dc=mountaincable,dc=net

然后才能有

dn:  ou=mail,RCCD=AAA3140003t,dc=mountaincable,dc=net
dn:  ou=ftp,RCCD=AAA3140003t,dc=mountaincable,dc=net

接下来才是
dn:  uid=pmartin,ou=mail,RCCD=AAA3140003t,dc=mountaincable,dc=net
dn:  uid=pmartin,ou=ftp,RCCD=AAA3140003t,dc=mountaincable,dc=net

这样在IMPORT的时候才能按正确的顺序建立LDAP的ENTRY。然而现在却出问题了,在EXPORT产生的LDIF文件中,有少部分RCCD记录的数据不是按上面说的顺序排列,而是
dn: RCCD=AAA3140003t,dc=mountaincable,dc=net

出现在最后,这样在IMPORT的时候,对于

dn:  ou=mail,RCCD=AAA3140003t,dc=mountaincable,dc=net
dn:  ou=ftp,RCCD=AAA3140003t,dc=mountaincable,dc=net

因为dn: RCCD=AAA3140003t,dc=mountaincable,dc=net还没有建立,所以建立ou=mail和ou=ftp出错,错误代码err=32(记得应该是 no such objects吧?)

请问出现这样的问题可能的原因是什么?LDAP BROWSER的BUG?问题是在几万个用户的数据输出到LDIF时,只有少数几十个用户的数据出现这样的问题,其他绝大多数都正常。除了用手工或者程序修改EXPORT产生的错误LDIF文件的DN排列顺序外,还有什么办法产生正确顺序的LDIF文件?

谢谢。

[ 本帖最后由 001CEO 于 2007-4-13 23:56 编辑 ]

mountain cable ldap.JPG (48.61 KB, 下载次数: 61)

LDAP结构

LDAP结构

论坛徽章:
0
2 [报告]
发表于 2007-04-14 14:42 |只看该作者
Did you try to use slapcat to dump your data from ldap server? Maybe it caused by the interoperability between LDAP BROWSER 2.8.1 and OPENLDAP 2.0.27.

论坛徽章:
0
3 [报告]
发表于 2007-04-16 23:50 |只看该作者

用slapcat的结果更糟 :(

用LDAP BROWSER就只有少数记录的顺序错误,属性内容没发现有错误的,用slapcat的结果,数据顺序完全乱套了,而且还有一些属性的值也是错误的,而且在slapcat产生的LDIF文件中出现以下内容

creatorsName: cn=Manager,dc=mountaincable,dc=net
createTimestamp: 20021202143249Z
modifiersName: cn=Manager,dc=mountaincable,dc=net
modifyTimestamp: 20021202143249Z

这些内容是在某个用户的RCCD记录之下,这在LDAP BROWSER产生的LDIF文件中是没有的。
dn: ou=mail, RCCD=AAA3149135m, dc=mountaincable, dc=net
objectClass: top
objectClass: organizationalUnit
ou: mail
creatorsName: cn=Manager,dc=mountaincable,dc=net
createTimestamp: 20021202143249Z
modifiersName: cn=Manager,dc=mountaincable,dc=net
modifyTimestamp: 20021202143249Z

论坛徽章:
0
4 [报告]
发表于 2007-04-17 09:13 |只看该作者
原帖由 001CEO 于 2007-4-16 23:50 发表
creatorsName: cn=Manager,dc=mountaincable,dc=net
createTimestamp: 20021202143249Z
modifiersName: cn=Manager,dc=mountaincable,dc=net
modifyTimestamp: 20021202143249Z

This formate is absolutely right. ldapsearch is not to design for backup data, and one of the immediate reasons is the ldif file which is generated by ldapsearch command is loss of integrity. Some of the internal attribute value could not be dumped into the ldif file.
You can just use slapadd to recover ldif file output by slapcat regardless what the entries' sequence is.

论坛徽章:
0
5 [报告]
发表于 2007-04-18 21:46 |只看该作者

这个结果会有问题

上面显示的是slapcat产生的,不是ldapsearch产生的。如果直接把这样顺序有错误的LDIF文件导入到新的LDAP中,有错误的那些记录将不会被导入,我已经试验过了  :(

原帖由 neophiliac 于 2007-4-17 09:13 发表

This formate is absolutely right. ldapsearch is not to design for backup data, and one of the immediate reasons is the ldif file which is generated by ldapsearch command is loss of integrity. Som ...
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP