6.2. 定义适用于所有新创建的数据库的默认索引


Directory 服务器中的默认索引定义了一组要索引的属性。当您创建新数据库时,Directory 服务器会将来自 cn=default index,cn=config,cn=ldbm database,cn=plugins,cn=config 条目中的默认索引 属性复制到特定于数据库的 cn=index,cn=database_name,cn=ldbm database,cn=plugins,cn=config 条目。

注意

目录服务器不会将默认索引中的更改应用到现有数据库。

6.2.1. 默认索引属性

目录服务器在 cn=default index ,cn=config,cn=ldbm database,cn=plugins,cn=config 条目中存储默认索引 属性。要显示它们,包括其索引类型,请输入:

# ldapsearch -D "cn=Directory Manager" -W -H ldap://server.example.com -b "cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config" -s one -o ldif-wrap=no
Copy to Clipboard Toggle word wrap
Expand
表 6.1. 目录服务器默认索引属性

aci

cn

entryUSN

entryUUID

givenName

mail

mailAlternateAddress

mailHost

成员

memberOf

nsUniqueId

nsCertSubjectDN

nsTombstoneCSN

ntUniqueId

ntUserDomainId

numSubordinates

objectClass

owner

parentId

seeAlso

sn

targetUniqueId

telephoneNumber

uid

uniqueMember

  
警告

从数据库索引中删除表(系统索引)中列出的属性可能会显著影响目录服务器性能。

6.2.2. 维护默认索引

目录服务器在 cn=default index ,cn=config,cn=ldbm database,cn=plugins,cn=config 条目中存储默认索引 属性。请注意,您只能使用 LDIF 语句维护默认的索引属性。

流程

  • 例如,要使用索引类型 eqsubroomNumber 属性添加到默认索引中,请输入:

    # 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: sub
    Copy to Clipboard Toggle word wrap

    LDIF 声明的解释:

    • swig: nsIndex :定义此条目是一个索引条目。
    • swig: 顶部 :索引条目中额外需要此对象类。
    • 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
    Copy to Clipboard Toggle word wrap
  • 例如,要从 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
    Copy to Clipboard Toggle word wrap
  • 例如,要从默认索引中删除 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
    Copy to Clipboard Toggle word wrap

验证

  • 列出默认索引属性以验证您的更改:

    # 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
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat