Chapter 4. Switching an instance to read-only mode
By default, instances run in read-write mode, in which users can both retrieve and store data. In emergency cases, such as when you want to prevent replication or disable modification of data during reindexing, but keep the directory available, you can temporarily switch the instance to read-only mode.
If Directory Server maintains more than one database and all databases need to be switched to read-only, you can do this in a single operation, on the command line or in the web console.
In read-only mode, you cannot restart the instance, but you may still modify the configuration.
If you stop an instance in read-only mode, you cannot start it again until you manually disable read-only mode.
To disable read-only mode manually, open the /etc/dirsrv/slapd-instance_name/dse.ldif file, navigate to the cn=config section, and set the nsslapd-readonly parameter to off.
4.1. Prerequisites Copy linkLink copied to clipboard!
- The instance is in read-write mode.
- The instance is not used in replication, since enabling read-only mode disables replication.
4.2. Switching an instance to read-only mode using the command line Copy linkLink copied to clipboard!
This procedure instructs you how to switch a Directory Server instance to read-only mode on the command line.
Procedure
Set the
nsslapd-readonlyparameter toon:dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-readonly=on
# dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-readonly=onCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Attempt a write operation to the directory, such as:
ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x
# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x dn: dc=example,dc=com changetype: modify add: description description: fooCopy to Clipboard Copied! Toggle word wrap Toggle overflow The server should refuse to perform.
modifying entry "dc=example,dc=com" ldap_modify: Server is unwilling to perform (53) additional info: Server is read-only
modifying entry "dc=example,dc=com" ldap_modify: Server is unwilling to perform (53) additional info: Server is read-onlyCopy to Clipboard Copied! Toggle word wrap Toggle overflow
4.3. Switching an instance to read-only mode using the web console Copy linkLink copied to clipboard!
This procedure instructs you how to switch a Directory Server instance to read-only mode in a browser.
Prerequisites
- You are logged in to the instance in the web console.
Procedure
-
Under
Server, select theAdvanced Settingstab. -
Check the
Server Read-Onlyoption. - Click .
Verification
Attempt a write operation to the directory, such as:
ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x
# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x dn: dc=example,dc=com changetype: modify add: description description: fooCopy to Clipboard Copied! Toggle word wrap Toggle overflow The server should refuse to perform.
modifying entry "dc=example,dc=com" ldap_modify: Server is unwilling to perform (53) additional info: Server is read-only
modifying entry "dc=example,dc=com" ldap_modify: Server is unwilling to perform (53) additional info: Server is read-onlyCopy to Clipboard Copied! Toggle word wrap Toggle overflow