12.10. Dynamically Reloading Schema
By default, the schema files used by the Directory Server instance are loaded into the directory when it is started. This means that any new schema files added to the schema directory are not available for use unless the server is restarted. The Directory Server has a task which manually reloads the full schema for the Directory Server instance, including custom files, without requiring a server restart.
You can reload the schema using one of the following methods:
- The
dsconf schema reload
command. See Section 12.10.1, “Dynamically Reloading the Schema Using thedsconf schema reload
Command” - A
cn=tasks
entry. See Section 12.10.2, “Dynamically Reloading the Schema Using acn=tasks
Entry”
Note
Directory Server always additionally reloads the all schema files stored in the
/usr/share/dirsrv/schema/
directory.
12.10.1. Dynamically Reloading the Schema Using the dsconf schema reload
Command
Use the
dsconf schema reload
command to reload the schema:
# dsconf -D "cn=Directory Manager" ldap://server.example.com schema reload Attempting to add task entry... This will fail if Schema Reload plug-in is not enabled. Successfully added task entry cn=schema_reload_2018-08-28T09:45:48.027962,cn=schema reload task,cn=tasks,cn=config To verify that the schema reload operation was successful, please check the error logs
By default, Directory Server reloads the schema files stored in the directory set in the
nsslapd-schemadir
parameter. Optionally, pass the -d directory
option to the command to reload the schema stored in a different directory.
12.10.2. Dynamically Reloading the Schema Using a cn=tasks
Entry
The
cn=tasks,cn=config
entry in the Directory Server configuration is a container entry for temporary entries the server uses to manage tasks. To initiate a schema reload operation, create a task in the cn=schema reload task,cn=tasks,cn=config
entry.
By default, Directory Server reloads the schema files stored in the directory set in the
nsslapd-schemadir
parameter. For example, to reload the schema files stored in the directory set in this parameter:
# ldapadd -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: cn=example_schema_reload,cn=schema reload task,cn=tasks,cn=config objectclass: extensibleObject cn: cn=example_schema_reload
Optionally, specify the
schemadir
parameter, to reload the schema stored in a different directory. For example:
# ldapadd -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: cn=example_schema_reload,cn=schema reload task,cn=tasks,cn=config objectclass: extensibleObject cn: cn=example_schema_reload schemadir: /example/schema/
When the task is completed, the entry is removed from the directory configuration.
For further details about the
cn=schema reload task,cn=tasks,cn=config
entry, see the cn=schema reload task section in the Red Hat Directory Server Configuration, Command, and File Reference.
12.10.3. Reloading The Schema in a Replication Topology
The schema reload task is a local operation, so schema changes are not replicated in a multi-supplier environment if the schema is added to one supplier but not to the others. To load the new schema files on all of the supplier servers:
- Stop replication. See Section 15.9, “Disabling and Re-enabling Replication”.
- Copy the new schema file over and run the schema reload task for every supplier and replica server. See:
- Restart replication. See Section 15.9, “Disabling and Re-enabling Replication”.
12.10.4. Schema Reload Errors
When the schema reload task runs, the server does not return whether it completed successfully. To verify the schema reload operation was successful, check the error logs. The schema reload has two tasks, first validating the schema file and then loading it.
A success message shows that the validation passed and the task finished.
[06/Jan/2009:17:52:04.001214874 -0500] schemareload - Schema reload task starts (schema dir: default) ... [06/Jan/2009:17:52:04.754335904 -0500] schemareload - Schema validation passed. [06/Jan/2009:17:52:04.894255328 -0500] schemareload - Schema reload task finished.
If there is a failure, then the logs show which step failed and why.
[..] schemareload - Schema reload task starts (schema dir: /bogus) ... [..] schema - No schema files were found in the directory /bogus [..] schema_reload - schema file validation failed [..] schemareload - Schema validation failed.