Product SiteDocumentation Site

3.4. Using Referrals

Referrals tell client applications which server to contact for a specific piece of information. This redirection occurs when a client application requests a directory entry that does not exist on the local server or when a database has been taken off-line for maintenance. This section contains the following information about referrals:

3.4.1. Starting the Server in Referral Mode

/usr/sbin/ns-slapd refer -D /usr/lib/dirsrv/slapd-instance_name [-p port] -r referral_url

3.4.2. Setting Default Referrals

Default referrals are returned to client applications that submit operations on a DN not contained within any of the suffixes maintained by the directory. The following procedures describes setting a default referral for the directory using the console and the command-line utilities.

3.4.2.2. Setting a Default Referral from the Command Line

ldapmodify can add a default referral to the cn=config entry in the directory's configuration file. For example, to add a new default referral from one Directory Server, dir1.example.com, to a server named dir2.example.com, add a new line to the cn=config entry.
  1. ldapmodify -h dir1.example.com -p 389 -D "cn=directory manager" -w secret
    
    ldapmodify binds to the server and prepares it to change an entry in the configuration file.
  2. Add the default referral to the dir2.example.com server:
    dn: cn=config
    changetype: modify
    replace: nsslapd-referral
    nsslapd-referral: ldap://dir2.example.com/
    
After adding the default referral to the cn=config entry of the directory, the directory will return the default referral in response to requests made by client applications. The Directory Server does not need to be restarted.

3.4.3. Creating Smart Referrals

Smart referrals map a directory entry or directory tree to a specific LDAP URL. Using smart referrals, client applications can be referred to a specific server or a specific entry on a specific server.
For example, a client application requests the directory entry uid=jdoe,ou=people,dc=example,dc=com. A smart referral is returned to the client that points to the entry cn=john doe,o=people,l=europe,dc=example,dc=com on the server directory.europe.example.com.

3.4.3.1. Creating Smart Referrals Using the Directory Server Console

To configure smart referrals, do the following:
  1. In the Directory Server Console, select the Directory tab.
  2. ldap://hostname:portnumber/[optional_dn]
    
    ldap://directory.example.com:389/cn=john doe,o=people,l=europe,dc=example,dc=com
    
    ldap://hostname:portnumber/
    
The following procedure describes creating a referral in a suffix. This means that the suffix processes operations using a referral rather than a database or database link.

WARNING

When a suffix is configured to return referrals, the ACIs contained by the database associated with the suffix are ignored.

3.4.4.2. Creating Suffix Referrals from the Command Line

Add a suffix referral to the root or sub suffix entry in the directory configuration file under the cn=mapping tree,cn=config branch.
  1. Run ldapmodify.[2] For example:
    ldapmodify -a -h example.com -p 389 -D "cn=directory manager" -w secret
    
    The ldapmodify utility binds to the server and prepares it to add information to the configuration file.
  2. Add a suffix referral to the ou=people,dc=example,dc=com root suffix, as follows:
    dn: cn=ou=people,dc=example,dc=com,cn=mapping tree,cn=config
    objectclass: extensibleObject
    objectclasss: nsmappingtree
    nsslapd-state: referral
    nsslapd-referral: ldap://zanzibar.com/
    
    The nsslapd-state attribute is set to referral, meaning that a referral is returned for requests made to this suffix. The nsslapd-referral attribute contains the LDAP URL of the referral returned by the suffix, in this case a referral to the zanzibar.com server.
    The nsslapd-state attribute can also be set to referral on update. This means that the database is used for all operations except update requests. When a client application makes an update request to a suffix set to referral on update, the client receives a referral.
For more information about the suffix configuration attributes, refer to Table 3.1, “Suffix Attributes”.