1.4. 维护默认索引
目录服务器将默认索引属性存储在 cn=default 索引,cn=config,cn=ldbm database,cn=plugins,cn=config 条目中。请注意,您只能使用 LDIF 语句维护默认索引属性。
流程
例如,要将
roomNumber属性添加到带有索引类型eq和sub的默认索引中,请输入:# ldapadd -D "cn=Directory Manager" -W -H ldap://server.example.com -x dn: cn=roomNumber,cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config objectClass: nsIndex objectClass: top cn: roomNumber nsSystemIndex: false nsIndexType: eq nsIndexType: subLDIF 声明的解释:
-
CamelAwsS: nsIndex: 定义此条目是索引条目。 -
top
: top: 此对象类在索引条目中额外需要。 -
cn:将属性的名称设置为 index。 -
nsSystemIndex:指示索引对目录服务器操作至关重要。 -
nsIndexType:此多值属性指定索引类型。
-
例如,要将
pres索引类型添加到roomNumber属性的默认索引属性中,请输入:# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x dn: cn=roomNumber,cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config changetype: modify add: nsIndexType nsIndexType: pres例如,要从
roomNumber属性的默认索引属性中删除pres索引类型,请输入:# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x dn: cn=roomNumber,cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config changetype: modify delete: nsIndexType nsIndexType: pres例如,要从默认索引中删除
roomNumber属性,请输入:# ldapdelete -D "cn=Directory Manager" -W -H ldap://server.example.com -x cn=roomNumber,cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config
验证
列出默认索引属性以验证您的更改:
# ldapsearch -H ldap://server.example.com:389 -D "cn=Directory Manager" -W -b "cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config" -x -s one -o ldif-wrap=no