chap-server-process.xml revision 429cb4af0dd170c44fe076f66fb43338d1820073
<?xml version="1.0" encoding="UTF-8"?>
<!--
! CCPL HEADER START
!
! This work is licensed under the Creative Commons
! Attribution-NonCommercial-NoDerivs 3.0 Unported License.
! To view a copy of this license, visit
! http://creativecommons.org/licenses/by-nc-nd/3.0/
! or send a letter to Creative Commons, 444 Castro Street,
! Suite 900, Mountain View, California, 94041, USA.
!
! You can also obtain a copy of the license at
! trunk/opendj3/legal-notices/CC-BY-NC-ND.txt.
! See the License for the specific language governing permissions
! and limitations under the License.
!
! If applicable, add the following below this CCPL HEADER, with the fields
! enclosed by brackets "[]" replaced with your own identifying information:
! Portions Copyright [yyyy] [name of copyright owner]
!
! CCPL HEADER END
!
! Copyright 2011-2013 ForgeRock AS
!
-->
<chapter xml:id='chap-server-process'
xmlns='http://docbook.org/ns/docbook' version='5.0' xml:lang='en'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd'
xmlns:xlink='http://www.w3.org/1999/xlink'
xmlns:xinclude='http://www.w3.org/2001/XInclude'>
<title>Managing Server Processes</title>
<para>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.</para>
<para>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.</para>
<section xml:id="start-server">
<title>Starting a Server</title>
<indexterm><primary>Start server</primary></indexterm>
<itemizedlist>
<para>Use one of the following techniques.</para>
<listitem>
<para>Use the <command>start-ds</command> command.</para>
<screen>$ start-ds</screen>
<para>Alternatively, you can specify the --no-detach option to start
the server in the foreground.</para>
</listitem>
<listitem>
<para>(UNIX) Create an RC script, and then use the script to start
the server.</para>
<para>Unless you run OpenDJ as root, use the --userName
<replaceable>userName</replaceable> option to specify the user
who installed OpenDJ.</para>
<screen>$ sudo create-rc-script
--outputFile /etc/init.d/opendj
--userName mark
$ sudo /etc/init.d/opendj start</screen>
<para>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.</para>
<screen>$ sudo update-rc.d opendj defaults
update-rc.d: warning: /etc/init.d/opendj missing LSB information
update-rc.d: see &lt;http://wiki.debian.org/LSBInitScripts&gt;
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</screen>
</listitem>
<listitem>
<para>(Windows) Register OpenDJ as a Windows Service, and then manage
the service through Windows administration tools.</para>
<screen>C:\path\to\opendj\bat&gt; windows-service.bat --enableService</screen>
</listitem>
</itemizedlist>
<para>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
<literal>save-config-on-successful-startup</literal> to
<literal>false</literal>.</para>
</section>
<section xml:id="stop-server">
<title>Stopping a Server</title>
<indexterm><primary>Stop server</primary></indexterm>
<itemizedlist>
<para>Use one of the following techniques.</para>
<listitem>
<para>Use the <command>stop-ds</command> command.</para>
<screen>$ stop-ds</screen>
</listitem>
<listitem>
<para>(UNIX) Create an RC script, and then use the script to stop
the server.</para>
<screen>$ sudo create-rc-script
--outputFile /etc/init.d/opendj
--userName mark
$ sudo /etc/init.d/opendj stop</screen>
</listitem>
<listitem>
<para>(Windows) Register OpenDJ as a Windows Service, and then manage
the service through Windows administration tools.</para>
<screen>C:\path\to\opendj\bat&gt; windows-service.bat --enableService</screen>
</listitem>
</itemizedlist>
</section>
<section xml:id="restart-server">
<title>Restarting a Server</title>
<indexterm><primary>Restart server</primary></indexterm>
<itemizedlist>
<para>Use one of the following techniques.</para>
<listitem>
<para>Use the <command>stop-ds</command> command.</para>
<screen>$ stop-ds --restart</screen>
</listitem>
<listitem>
<para>(UNIX) Create an RC script, and then use the script to stop
the server.</para>
<screen>$ sudo create-rc-script
--outputFile /etc/init.d/opendj
--userName mark
$ /etc/init.d/opendj restart</screen>
</listitem>
<listitem>
<para>(Windows) Register OpenDJ as a Windows Service, and then manage
the service through Windows administration tools.</para>
<screen>C:\path\to\opendj\bat&gt; windows-service.bat --enableService</screen>
</listitem>
</itemizedlist>
</section>
<section xml:id="crash-recovery">
<title>Server Recovery</title>
<indexterm>
<primary>Replication</primary>
<secondary>Crash recovery</secondary>
</indexterm>
<para>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.</para>
<para>You can find Berkeley Java Edition database recovery messages in the
database log file, such as
<filename>/path/to/opendj/db/userRoot/je.info.0</filename>. 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.</para>
<screen>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 ...</screen>
<para>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
<link xlink:href="${configRefBase}local-db-backend.html#preload-time-limit"
><literal>preload-time-limit</literal></link> for the database cache of your
backend if you do want to load objects into the database cache before
OpenDJ begins accepting client connections.</para>
</section>
</chapter>