日期:2014-05-16  浏览次数:21096 次

如何导入apache DS的数据
1. 安装好ApacheDS后, 启动ApacheDS server,可以用后台命令运行$nohup ./apacheds.sh &

注意, apacheds.sh <instance_name>可以启动一个自命名server instance, 否则是'default' instance. 不同instance上要各自创建各自的partition.

2. 下载并安装Apache Directory Studio, 注意JRE版本需6.0以上, 否则启动失败.

3. launch studio后 New connection, 输入hostname, port选择10389,因为我们装的是ApacheDS

4. 连接成功后, 右键单击connection的名字, 选择open configuration, 在All partitionsAdd一个新的partition, partition的名字可以任意写. suffix理论上也可以任意写, 但为了和下面导入的数据结构一致, 我们只需输入o=sevenSeas, 注意不要写成别的, 否则导入数据会失败. 还有非常重要的一点是创建完partition后要重启server, 否则新创建的partition没法在tree上显示出来.文档上说重启server后要右键单击RootDSE来手动创建对应的namingContexts, 并把o=sevenSeas作为value写进去, 但是我发现studio新版本在重启server后已经可以自动添加了.

# Sample LDIF data for the ApacheDS v1.0 Basic User's Guide
#
# Some sailors and their ships
# userpassword for all persons is "pass"
#
version: 1

dn: ou=people,o=sevenSeas
objectclass: organizationalUnit
objectclass: top
description: Contains entries which describe persons (seamen)
ou: people

dn: ou=groups,o=sevenSeas
objectclass: organizationalUnit
objectclass: top
description: Contains entries which describe groups (crews, for instance)
ou: groups

dn: ou=crews,ou=groups,o=sevenSeas
objectclass: organizationalUnit
objectclass: top
description: Contains entries which describe ship crews
ou: crews

dn: ou=ranks,ou=groups,o=sevenSeas
objectclass: organizationalUnit
objectclass: top
description: Contains entries which describe naval ranks (e.g. captain)
ou: ranks

# HMS Lydia Crew
# --------------

dn: cn=Horatio Hornblower,ou=people,o=sevenSeas
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: top
cn: Horatio Hornblower
description: Capt. Horatio Hornblower, R.N
givenname: Horatio
sn: Hornblower
uid: hhornblo
mail: hhornblo@royalnavy.mod.uk
userpassword: {SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ=

dn: cn=William Bush,ou=people,o=sevenSeas
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: top
cn: William Bush
description: Lt. William Bush
givenname: William
manager: cn=Horatio Hornblower,ou=people,o=sevenSeas
sn: Bush
uid: wbush
mail: wbush@royalnavy.mod.uk
userpassword: {SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ=

dn: cn=Thomas Quist,ou=people,o=sevenSeas
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: top
cn: Thomas Quist
description: Seaman Quist
givenname: Thomas
manager: cn=Horatio Hornblower,ou=people,o=sevenSeas
sn: Quist
uid: tquist
mail: tquist@royalnavy.mod.uk
userpassword: {SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ=

dn: cn=Moultrie Crystal,ou=people,o=sevenSeas
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: top
cn: Moultrie Crystal
description: Lt. Crystal
givenname: Moultrie
manager: cn=Horatio Hornblower,ou=people,o=sevenSeas
sn: Crystal
uid: mchrysta
mail: mchrysta@royalnavy.mod.uk
userpassword: {SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ=

dn: cn=HMS Lydia,ou=crews,ou=groups,o=sevenSeas
objectclass: groupOfUniqueNames
objectclass: top
cn: HMS Lydia
uniquemember: cn=Horatio Hornblower,ou=people,o=sevenSeas
uniquemember: cn=William Bush,ou=people,o=sevenSeas
uniquemember: cn=Thomas Quist,ou=people,o=sevenSeas
uniquemember: cn=Moultrie Crystal,ou=people,o=sevenSeas

# HMS Victory Crew
# ----------------

dn: cn=Horatio Nelson,ou=people,o=sevenSeas
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: top
cn: Horatio Nelson
description: Lord Horatio Nelson
givenname: Horatio
sn: Nelson
uid: hnelson
mail: hnelson@royalnavy.mod.uk
userpassword: {SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ=

dn: cn=Thomas Masterman Hardy,ou=people,o=sevenSeas
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: top
cn: Thomas Masterman Hardy
description: Sir Thomas Masterman Hardy