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. $ opendj/bin/start-ds Alternatively, you can specify the --no-detach option to start the server in the foreground. (UNIX) Create an RC script, 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 opendj/bin/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, and then manage the service through Windows administration tools. C:\Users\Mark> 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. $ opendj/bin/stop-ds (UNIX) Create an RC script, and then use the script to stop the server. $ sudo opendj/bin/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:\Users\Mark> opendj\bat\windows-service.bat --enableService
Restarting a Server Restart server Use one of the following techniques. Use the stop-ds command. $ opendj/bin/stop-ds --restart (UNIX) Create an RC script, and then use the script to stop the server. $ sudo opendj/bin/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:\Users\Mark> 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. You can find Berkeley Java Edition database recovery messages in the database log file, such as /path/to/opendj/db/userRoot/je.info.0. The following shows two example messages from that log, the first written at the beginning of the recovery process, the second 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 a preload-time-limit for the database cache of your backend if you do want to load objects into the database cache before OpenDJ begins accepting client connections.