1.4. 维护默认索引


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

流程

  • 例如,要将 roomNumber 属性添加到带有索引类型 eqsub 的默认索引中,请输入:

    # 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

    LDIF 声明的解释:

    • 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
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2026 Red Hat
返回顶部