The rebuild-index command rebuilds a directory server index.
This command is not supported for the proxy.
The rebuild-index command is used to rebuild directory server indexes. Indexes are files that contain lists of values, where each value is associated with a list of entry identifiers to suffixes in the directory server database. When the directory server processes a search request, it searches the database using the list of entry identifiers in the indexes, thus speeding up the search. If indexes did not exist, the directory server would have to look up each entry in the database, which dramatically degrades performance.
The rebuild-index command is useful in the following cases:
When the index-entry-limit property of an index changes
When a new index is created
The rebuild-index command can be run with the server online. However, the backend database is unavailable while rebuild-index is running. Also, the rebuild-index command usually runs faster with the server offline, especially if the --rebuildAll option is specified.
The rebuild-index command accepts an option in either its short form (for example, -b baseDN) or its long form equivalent (for example, --baseDN baseDN).
Specify the base DN of a back end that supports indexing. The rebuild operation is performed on indexes within the scope of the given base DN.
Specify the name of the indexes to rebuild. For an attribute index, this is simply an attribute name. At least one index must be specified for rebuild.
Rebuild all indexes that are contained in the back end that is specified by the base DN. This option not only re-indexes all attribute indexes but also the dn2id system index, any extensible and VLV indexes, and the dn2uri index. The rebuildAll option cannot be used with the -i option.
Specify the location of a temporary work directory for scratch index files. The default temporary work directory is install-dir/import-tmp.
Rebuilding an index online requires access to the tasks back end. Access to the tasks back end is provided over SSL through the administration connector. These connection options are used when the rebuild runs online.
Use the bind DN to authenticate to the directory server. This option is used when performing simple authentication and is not required if SASL authentication is used. The default value for this option is cn=Directory Manager.
Contact the directory server on the specified hostname or IP address. If this option is not provided, a default of localhost is used.
Use the bind password in the specified file when authenticating to the directory server. This option must not be used in conjunction with --bindPassword.
Use the client keystore certificate in the specified path.
Use the specified certificate for client authentication.
Use the specified options for SASL authentication .
Contact the directory server at the specified administration port. If this option is not provided, the default administration port of 4444 is used.
Use the client trust store certificate in the specified path. This option is not needed if --trustAll is used, although a trust store should be used when working in a production environment.
Use the password needed to access the certificates in the client trust store. This option is only required if --trustStorePath is used and the specified trust store requires a password in order to access its contents (which most trust stores do not require). This option must not be used in conjunction with --trustStorePasswordFile.
Use the password in the specified file to access the certificates in the client keystore. This option is only required if --keyStorePath is used. This option must not be used in conjunction with --keyStorePassword.
Use the password in the specified file to access the certificates in the client trust store. This option is only required if --trustStorePath is used and the specified trust store requires a password in order to access its contents (most trust stores do not require this). This option must not be used in conjunction with --trustStorePassword.
Use the bind password when authenticating to the directory server. This option can be used for simple authentication as well as password-based SASL mechanisms. This option must not be used in conjunction with --bindPasswordFile. To prompt for the password, type -w -.
Use the password needed to access the certificates in the client keystore. This option is only required if --keyStorePath is used. This option must not be used in conjunction with --keyStorePasswordFile.
Trust all server SSL certificates that the directory server presents. This option can be used for convenience and testing purposes, but for security reasons a trust store should be used to determine whether the client should accept the server certificate.
These options are used when you specify that the index should be rebuilt as a scheduled task.
Specify the email address of a recipient to be notified when the task completes. This option can be specified more than once in a single command.
Specify the ID of a task upon which this task depends. A task does not start executing until all of its dependencies have completed execution.
Specify the email address of a recipient to be notified if an error occurs when this task executes. This option can be specified more than once in a single command.
Specify the action that this task will take if one of its dependent tasks fails. The value must be one of PROCESS, CANCEL, or DISABLE. If no value is specified, the default action is CANCEL.
Indicates that the task is recurring and will be scheduled according to the schedulePattern, expressed as a crontab(5) compatible time and date pattern.
Indicates the date and time at which the operation starts when scheduled as a directory server task expressed in the format YYYYMMDDhhmmss. A value of 0 schedules the task for immediate execution. When this option is specified, the operation is scheduled to start at the specified time after which the command exits immediately.
Path to the file containing default property values used for command line
No properties file will be used to get default command line argument values.
Display command-line usage information for the command and exit without making any attempt to stop or restart the directory server.
Display the version information for the directory server and exit rather than attempting to run this command.
The following examples show how to use the directory server commands. You can use the commands on any UNIX, Linux, or Windows system that has at least the Java SE 5 (at least Sun version 1.5.0_08, preferably the latest version of Java SE 6) runtime environment installed on its target system. See Sun OpenDS Standard Edition System Requirements in Sun OpenDS Standard Edition 2.2 Installation Guide for more information.
First, display a list of indexes by using the dsconfig command. The command specifies the subcommand list-je-indexes, the port (-p), the back-end name userRoot (-n), the bind DN (-D), and the bind password (-w) and displays the indexes for the given back end:
$ dsconfig -h localhost -p 4444 -D "cn=Directory Manager" -w password -X -n \ list-local-db-indexes --backend-name userRoot Local DB Index : Type : index-type ----------------:---------:-------------------- aci : generic : presence cn : generic : equality, substring ds-sync-hist : generic : ordering entryUUID : generic : equality givenName : generic : equality, substring mail : generic : equality, substring member : generic : equality objectClass : generic : equality sn : generic : equality, substring telephoneNumber : generic : equality, substring uid : generic : equality uniqueMember : generic : equality
The following command rebuilds indexes (-i) with a base DN (-b).
Because this command runs offline, the directory server must be stopped before you run it.
$ rebuild-index -b dc=example,dc=com -i uid -i mail [31/Jul/2007:01:51:59 -0500] category=BACKEND severity=NOTICE msgID=8388745 msg Rebuild of index(es) uid, mail started with 320 total records to process [31/Jul/2007:01:52:00 -0500] category=BACKEND severity=NOTICE msgID=8388741 msg Rebuild complete. Processed 320 records in 0 seconds (average rate 445.7/sec)
This example uses the --rebuildAll option to rebuild all indexes.
$ rebuild-index -b "dc=example,dc=com" --rebuildAll
You can rebuild an extensible index in any of three ways:
Rebuild all indexes by specifying the --rebuildAll option.
Rebuild the attribute index on which the extensible index is based, by specifying the -i option. For example, -i cn.
All indexes based on this attribute are rebuilt, including any extensible indexes that are associated with the attribute.
Rebuild a specific extensible index by specifying it with the -i option. For example, -i cn.es.lte or -i sn.en.sub.
An exit code of 0 indicates that the operation completed successfully. An exit code of 1 indicates that an error occurred during processing.
The rebuild-index command is located at these paths:
UNIX and Linux: install-dir/bin/rebuild-index