1.索引的意义
- 提高对Openldap目录树的查询速度
- 提高性能
- 减轻对服务器的压力
2.搜索索引
ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config 'olcDatabase={2}bdb' olcDbindex
3. 创建索引
cat >> hdb-index.ldif << EOF
dn: olcDatabase={2}bdb, cn=config
changetype:modify
add:olcDbIndex
olcDbIndex: sn pres, eq, sub
EOF
4.导入索引
ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f hdb-index.ldif
modifying entry "olcDatabase={2}bdb, cn=config"
5. 验证索引
ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config 'olcDatabase={2}bdb' olcDbindex
dn: olcDatabase={2}bdb,cn=config
olcDbIndex: objectClass pres,eq
olcDbIndex: cn pres,eq,sub
olcDbIndex: uid pres,eq,sub
olcDbIndex: uidNumber pres,eq
olcDbIndex: gidNumber pres,eq
olcDbIndex: mail pres,eq,sub
olcDbIndex: ou pres,eq,sub
olcDbIndex: sn pres,eq,sub
olcDbIndex: givenName pres,eq,sub
olcDbIndex: loginShell pres,eq
olcDbIndex: memberUid pres,eq,sub
olcDbIndex: nisMapName pres,eq,sub
olcDbIndex: nisMapEntry pres,eq,sub