Chapter 4. Switching an instance to read-only mode
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. Warning 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 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 This procedure instructs you how to switch a Directory Server instance to read-only mode on the command line. Procedure Set the nsslapd-readonly parameter to on : # dsconf -D " cn=Directory Manager " ldap://server.example.com config replace nsslapd-readonly=on Verification Attempt a write operation to the directory, such as: # ldapmodify -D " cn=Directory Manager " -W -H ldap://server.example.com -x dn: dc=example,dc=com changetype: modify add: description description: foo 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 Additional resources Switching a database to read-only mode 4.3. Switching an instance to read-only mode using the web console 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 the Advanced Settings tab. Check the Server Read-Only option. Click Save . Verification Attempt a write operation to the directory, such as: # ldapmodify -D " cn=Directory Manager " -W -H ldap://server.example.com -x dn: dc=example,dc=com changetype: modify add: description description: foo 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 Additional resources Switching a database to read-only mode
dsconf -D " cn=Directory Manager " ldap://server.example.com config replace nsslapd-readonly=on ldapmodify -D " cn=Directory Manager " -W -H ldap://server.example.com -x dn: dc=example,dc=com changetype: modify add: description description: foo modifying entry "dc=example,dc=com" ldap_modify: Server is unwilling to perform (53) additional info: Server is read-only ldapmodify -D " cn=Directory Manager " -W -H ldap://server.example.com -x dn: dc=example,dc=com changetype: modify add: description description: foo modifying entry "dc=example,dc=com" ldap_modify: Server is unwilling to perform (53) additional info: Server is read-only