keactrl.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY mdash "&#x2014;" >
  5. ]>
  6. <chapter id="keactrl">
  7. <title>Managing Kea Servers With keactrl</title>
  8. <section id="keactrl-overview">
  9. <title>Overview</title>
  10. <para>keactrl is a shell script which controls the startup, shutdown
  11. and reconfiguration of the Kea servers, i.e. <command>kea-dhcp4</command>,
  12. <command>kea-dhcp6</command> and <command>kea-dhcp-ddns</command>. It also
  13. provides the means for checking the current status of the servers and
  14. returns the information whether the servers are active or inactive
  15. and also configuration data being used.
  16. </para>
  17. </section>
  18. <section id="keactrl-usage">
  19. <title>Command line options</title>
  20. <para>The usage of the <command>keactrl</command> is:
  21. <screen>
  22. keactrl &lt;command&gt; [-c keactrl-config-file] [-s server[,server,..]]
  23. </screen>
  24. </para>
  25. <para>
  26. The <command>&lt;command&gt;</command> specifies the one of the commands
  27. described in <xref linkend="keactrl-commands"/>.
  28. </para>
  29. <para>
  30. The <command>[-c keactrl-config-file]</command> parameter overrides
  31. the default location of the <command>keactrl</command> configuration
  32. file.
  33. </para>
  34. <para>
  35. The <command>[-s server[,server ...]]</command> parameter overrides
  36. the list of servers to which the command is issued.
  37. </para>
  38. </section>
  39. <section id="keactrl-config-file">
  40. <title>keactrl Configuration File</title>
  41. <para>
  42. keactrl starts servers in background and returns. Depending on the
  43. needs of the server's Administrator it is possible to select which
  44. of them are started and which are not. This is specified in the
  45. <filename>keactrl.conf</filename> file which by default is installed
  46. in <filename>[kea-install-dir]/etc/kea/</filename>.
  47. </para>
  48. <para>
  49. The default <filename>keactrl.conf</filename> file holds the following
  50. configuration:
  51. <screen>
  52. # This is a configuration file for keactrl script which controls
  53. # the startup, shutdown, reconfiguration and gathering the status
  54. # of the Kea servers.
  55. # prefix holds the location where the Kea is installed.
  56. prefix=/home/marcin/devel/kea-build
  57. # Location of Kea configuration file.
  58. kea_config_file=${prefix}/etc/kea/kea.conf
  59. # Location of Kea binaries.
  60. exec_prefix=${prefix}
  61. dhcp4_srv=${exec_prefix}/sbin/kea/b10-dhcp4
  62. dhcp6_srv=${exec_prefix}/sin/kea/b10-dhcp6
  63. dhcp_ddns_srv=${exec_prefix}/sbin/kea/b10-dhcp-ddns
  64. # Start DHCPv4 server?
  65. dhcp4=yes
  66. # Start DHCPv6 server?
  67. dhcp6=yes
  68. # Start DHCP DDNS server?
  69. dhcp_ddns=yes
  70. # Be verbose?
  71. kea_verbose=no
  72. </screen>
  73. </para>
  74. <para>
  75. The <parameter>dhcp4</parameter>, <parameter>dhcp6</parameter> and
  76. <parameter>dhcp_ddns</parameter> parameters set to "yes" configure
  77. <command>keactrl</command> to manage (start, reconfigure) all servers,
  78. i.e. <command>kea-dhcp4</command>, <command>kea-dhcp6</command> and
  79. <command>kea-dhcp-ddns</command>. When any of these parameters is set to
  80. "no" the <command>keactrl</command> will skip starting or reconfiguring
  81. the corresponding server.
  82. </para>
  83. <para>
  84. By default, Kea processes managed by <command>keactrl</command> are
  85. located in the <filename>[kea-install-dir]/sbin</filename>. This
  86. should work for most of the installations. However, if the default
  87. location needs to be altered for any reason, it can be achieved by
  88. modifying the paths specified with the <parameter>dhcp4_srv</parameter>,
  89. <parameter>dhcp6_srv</parameter> and <parameter>dhcp_ddns_srv</parameter>
  90. parameters.
  91. </para>
  92. <para>
  93. The <parameter>kea_verbose</parameter> parameter specifies the verbosity
  94. of the servers being started. When <parameter>kea_verbose</parameter>
  95. is set to "yes" the logging level of the server is set to DEBUG.
  96. Otherwise, the default logging level is used.
  97. </para>
  98. <note>
  99. <para>
  100. The verbosity for the server is specified when it is started. Once
  101. started, the verbosity can be only changed by stopping the server and
  102. starting it again with the new value of the
  103. <parameter>kea_verbose</parameter> parameter.
  104. </para>
  105. </note>
  106. </section>
  107. <section id="keactrl-commands">
  108. <title>Commands</title>
  109. <para>The following commands are supported by <command>keactrl</command>
  110. to perform specific operations on the Kea servers:
  111. <itemizedlist>
  112. <listitem><simpara>
  113. <command>start</command> - starts selected servers.
  114. </simpara></listitem>
  115. <listitem><simpara>
  116. <command>stop</command> - stops all running servers.
  117. </simpara></listitem>
  118. <listitem><simpara>
  119. <command>reload</command> - triggers reconfiguration of the
  120. selected servers by sending the SIGHUP signal to them.
  121. </simpara></listitem>
  122. <listitem><simpara>
  123. <command>status</command> - returns the status of the servers (active
  124. or inactive) and the <command>keactrl</command> configuration data.
  125. </simpara></listitem>
  126. </itemizedlist>
  127. </para>
  128. <para>The typical output from the <command>keactrl</command> when starting
  129. the servers looks similar to the following:
  130. <screen>
  131. <userinput>$ keactrl start</userinput>
  132. INFO/keactrl: Starting b10-dhcp4 -c /usr/local/etc/kea/kea.conf
  133. INFO/keactrl: Starting b10-dhcp6 -c /usr/local/etc/kea/kea.conf
  134. INFO/keactrl: Starting b10-dhcp-ddns -c /usr/local/etc/kea/kea.conf
  135. </screen>
  136. </para>
  137. <para>The following command stops all servers:
  138. <screen>
  139. <userinput>$ keactrl stop</userinput>
  140. INFO/keactrl: Skip sending signal 15 to process kea-dhcp6: process is not running
  141. </screen>
  142. Note that the <command>stop</command> will attempt to stop all servers
  143. regrdless if they are "enabled" in the <filename>keactrl.conf</filename>
  144. or not. If any of the servers is not running, the informational message
  145. is displayed as in the <command>stop</command> command output above.
  146. </para>
  147. <para>
  148. As already mentioned, the reconfiguration of each Kea server is triggered
  149. by the SIGHUP signal. The <command>reload</command> command sends
  150. the SIGHUP signal to selected servers (running and "enabled" through the
  151. <filename>keactrl.conf</filename> configuration file). When the server
  152. receives the SIGHUP signal it re-reads its configuration file and if
  153. the new configuration is valid it uses the new configuration. Use the
  154. following command to trigger reconfiguration of the servers:
  155. <screen>
  156. <userinput>$ keactrl reload</userinput>
  157. </screen>
  158. </para>
  159. <note>
  160. <para>
  161. Currently <command>keactrl</command> doesn't report configuration
  162. failures when the server is started or reconfigured. In order to
  163. check if the server's configuration succeeded the Kea log file
  164. must be examined for errors. The default location of the log file is
  165. <filename>[kea-install-dir]/var/kea/kea.log</filename>.
  166. </para>
  167. </note>
  168. <para>
  169. Sometimes it is useful to check which servers are running. One of the
  170. cases is when one needs to verify if the server successfully started as
  171. a result of executing <command>keactrl start</command> command. The
  172. typical output from the <command>status</command> command looks like
  173. this:
  174. <screen>
  175. <userinput>$ keactrl status</userinput>
  176. DHCPv4 server: active
  177. DHCPv6 server: inactive
  178. DHCP DDNS: active
  179. Kea configuration file: /usr/local/etc/kea/kea.conf
  180. keactrl configuration file: /usr/local/etc/kea/keactrl.conf
  181. </screen>
  182. </para>
  183. </section>
  184. <section id="keactrl-overriding-servers">
  185. <title>Overriding Servers Selection</title>
  186. <para>
  187. The <command>[-s server[,server]]</command> command line option
  188. allows for selecting the servers to which the
  189. <command>keactrl</command> command is issued. For example:
  190. <screen>
  191. <userinput>$ keactrl stop -s dhcp4,dhcp6</userinput>
  192. </screen>
  193. instructs the <command>keactrl</command> to only stop the
  194. <command>kea-dhcp4</command> and <command>kea-dhcp6</command> servers
  195. and leave the <command>kea-dhcp-ddns</command> running.
  196. </para>
  197. <para>
  198. Similarly:
  199. <screen>
  200. <userinput>$ keactrl start -s dhcp4,dhcp_ddns</userinput>
  201. </screen>
  202. will only start the <command>kea-dhcp4</command> and
  203. <command>kea-dhcp-ddns</command> servers and not
  204. <command>kea-dhcp6</command>. Note that the <command>start</command>
  205. and <command>reload</command> commands are different from
  206. <command>stop</command> in such a way that for the former
  207. <command>keactrl</command> will also check if the specified server
  208. is enabled in the <filename>keactrl.conf</filename> configuration file.
  209. If it is not enabled it will not be started (or reconfigured) even if
  210. listed after the <command>-s</command> command line option. For the
  211. <command>stop</command> command it is not checked if the server is
  212. enabled in the configuration file and all the listed servers will be
  213. stopped.
  214. </para>
  215. <para>
  216. The following keywords can be used with the <command>-s</command>
  217. command line option:
  218. <itemizedlist>
  219. <listitem><simpara>
  220. <command>dhcp4</command> for <command>kea-dhcp4.</command>
  221. </simpara></listitem>
  222. <listitem><simpara>
  223. <command>dhcp6</command> for <command>kea-dhcp6.</command>
  224. </simpara></listitem>
  225. <listitem><simpara>
  226. <command>dhcp_ddns</command> for <command>kea-dhcp-ddns.</command>
  227. </simpara></listitem>
  228. <listitem><simpara>
  229. <command>all</command> for all servers (default).
  230. </simpara></listitem>
  231. </itemizedlist>
  232. </para>
  233. </section>
  234. </chapter>