Managing Server Processes Using the OpenDJ Control Panel, you can start and stop local servers. You can also start and stop OpenDJ using command-line tools, and use the operating system's capabilities for starting OpenDJ at boot time. This chapter demonstrates how to start and stop server processes with command line tools and using operating system capabilities. This chapter also describes what OpenDJ directory server does during startup and shutdown, and how it recovers following an abrupt shutdown such as happens during a system crash or when you kill the server process using system tools.
Starting a Server Start server Use one of the following techniques. Use the start-ds command. $ start-ds Alternatively, you can specify the option to start the server in the foreground. (Linux) If OpenDJ directory server was installed from a .deb or .rpm package, then service management scripts were created at setup time. Use the service opendj start command. centos# service opendj start Starting opendj (via systemctl): [ OK ] ubuntu$ sudo service opendj start $Starting opendj: > SUCCESS. (UNIX) Create an RC script by using the create-rc-script command, and then use the script to start the server. Unless you run OpenDJ as root, use the --userName userName option to specify the user who installed OpenDJ. $ sudo create-rc-script \ --outputFile /etc/init.d/opendj \ --userName mark $ sudo /etc/init.d/opendj start For example, on Linux if you run OpenDJ as root, you can use the RC script to start the server at system boot, and stop the server at system shutdown. $ sudo update-rc.d opendj defaults update-rc.d: warning: /etc/init.d/opendj missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/opendj ... /etc/rc0.d/K20opendj -> ../init.d/opendj /etc/rc1.d/K20opendj -> ../init.d/opendj /etc/rc6.d/K20opendj -> ../init.d/opendj /etc/rc2.d/S20opendj -> ../init.d/opendj /etc/rc3.d/S20opendj -> ../init.d/opendj /etc/rc4.d/S20opendj -> ../init.d/opendj /etc/rc5.d/S20opendj -> ../init.d/opendj (Windows) Register OpenDJ as a Windows Service by using the windows-service command, and then manage the service through Windows administration tools. C:\path\to\opendj\bat> windows-service.bat --enableService By default OpenDJ saves a compressed version of the server configuration used on successful startup. This ensures that the server provides a "last known good" configuration, which can be used as a reference or copied into the active configuration if the server fails to start with the current active configuration. It is possible, though not usually recommended, to turn this behavior off by changing the global server setting save-config-on-successful-startup to false.
Stopping a Server Stop server Use one of the following techniques. Use the stop-ds command. $ stop-ds (Linux) If OpenDJ directory server was installed from a .deb or .rpm package, then service management scripts were created at setup time. Use the service opendj stop command. centos# service opendj stop Stopping opendj (via systemctl): [ OK ] ubuntu$ sudo service opendj stop $Stopping opendj: ... > SUCCESS. (UNIX) Create an RC script, and then use the script to stop the server. $ sudo create-rc-script \ --outputFile /etc/init.d/opendj \ --userName mark $ sudo /etc/init.d/opendj stop (Windows) Register OpenDJ as a Windows Service, and then manage the service through Windows administration tools. C:\path\to\opendj\bat> windows-service.bat --enableService
Restarting a Server Restart server Use one of the following techniques. Use the stop-ds command. $ stop-ds --restart (Linux) If OpenDJ directory server was installed from a .deb or .rpm package, then service management scripts were created at setup time. Use the service opendj restart command. centos# service opendj restart Restarting opendj (via systemctl): [ OK ] ubuntu$ sudo service opendj restart $Stopping opendj: ... > SUCCESS. $Starting opendj: > SUCCESS. (UNIX) Create an RC script, and then use the script to stop the server. $ sudo create-rc-script \ --outputFile /etc/init.d/opendj \ --userName mark $ /etc/init.d/opendj restart (Windows) Register OpenDJ as a Windows Service, and then manage the service through Windows administration tools. C:\path\to\opendj\bat> windows-service.bat --enableService
Server Recovery Replication Crash recovery OpenDJ tends to show resilience when restarting after a crash or after the server process is killed abruptly. OpenDJ might have to replay the last few entries in a transaction log. Generally OpenDJ returns to service quickly. Database recovery messages are found in the database log file, such as /path/to/opendj/db/userRoot/dj.log. For local-db type backends, the log file name is similar to /path/to/opendj/db/userRoot/je.info.0. The following example shows two example messages from the recovery log. The first message is written at the beginning of the recovery process. The second message is written at the end of the process. 111104 10:23:48:967 CONFIG [/path/to/opendj/db/userRoot]Recovery underway, found end of log ... 111104 10:23:49:015 CONFIG [/path/to/opendj/db/userRoot]Recovery finished: Recovery Info ... What can take some time during server startup is preloading database content into memory when the server starts. Objects cached in memory do not survive a crash. By default, OpenDJ does not cache objects in memory before starting to accept client requests. You can however set the preload-time-limit property for the database cache of your backend if you do want to load objects into the database cache before OpenDJ begins accepting client connections.