keactrl.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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 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 (<command>kea-dhcp4</command>,
  12. <command>kea-dhcp6</command>, <command>kea-dhcp-ddns</command> and
  13. <command>kea-ctrl-agent</command>). It also provides the means for
  14. checking the current status of the servers and determining the
  15. configuration files in use.
  16. </para>
  17. </section>
  18. <section id="keactrl-usage">
  19. <title>Command Line Options</title>
  20. <para><command>keactrl</command> is run as follows:
  21. <screen>
  22. keactrl &lt;command&gt; [-c keactrl-config-file] [-s server[,server,..]]
  23. </screen>
  24. </para>
  25. <para>
  26. <command>&lt;command&gt;</command> is the one of the commands
  27. described in <xref linkend="keactrl-commands"/>.
  28. </para>
  29. <para>
  30. The optional <command>-c keactrl-config-file</command> switch
  31. allows specification of an alternate <command>keactrl</command>
  32. configuration file. (<command>--ctrl-config</command> is a synonym for
  33. <command>-c</command>.) In the absence of <command>-c</command>,
  34. <command>keactrl</command> will use the default configuration
  35. file <filename>[kea-install-dir]/etc/kea/keactrl.conf</filename>.
  36. </para>
  37. <para>
  38. The optional <command>-s server[,server ...]</command> switch selects
  39. the servers to which the command is issued.
  40. (<command>--server</command> is a synonym for <command>-s</command>.)
  41. If absent, the command is sent to all servers enabled in the keactrl
  42. configuration file.
  43. If multiple servers are specified, they
  44. should be separated by commas with no intervening spaces.
  45. </para>
  46. </section>
  47. <section id="keactrl-config-file">
  48. <title>The keactrl Configuration File</title>
  49. <para>
  50. Depending on requirements, not all of the available servers need
  51. be run. The keactrl configuration file sets which servers are
  52. enabled and which are disabled. The default configuration
  53. file is <filename>[kea-install-dir]/etc/kea/keactrl.conf</filename>,
  54. but this can be overridden on a per-command basis using the
  55. <command>-c</command> switch.
  56. </para>
  57. <para>
  58. The contents of <filename>keactrl.conf</filename> are:
  59. <screen>
  60. # This is a configuration file for keactrl script which controls
  61. # the startup, shutdown, reconfiguration and gathering the status
  62. # of the Kea's processes.
  63. # prefix holds the location where the Kea is installed.
  64. prefix=@prefix@
  65. # Location of Kea configuration file.
  66. kea_dhcp4_config_file=@sysconfdir@/@PACKAGE@/kea-dhcp4.conf
  67. kea_dhcp6_config_file=@sysconfdir@/@PACKAGE@/kea-dhcp6.conf
  68. kea_dhcp_ddns_config_file=@sysconfdir@/@PACKAGE@/kea-dhcp-ddns.conf
  69. kea_ctrl_agent_config_file=@sysconfdir@/@PACKAGE@/kea-ctrl-agent.conf
  70. # Location of Kea binaries.
  71. exec_prefix=@exec_prefix@
  72. dhcp4_srv=@sbindir@/kea-dhcp4
  73. dhcp6_srv=@sbindir@/kea-dhcp6
  74. dhcp_ddns_srv=@sbindir@/kea-dhcp-ddns
  75. ctrl_agent_srv=@sbindir@/kea-ctrl-agent
  76. # Start DHCPv4 server?
  77. dhcp4=yes
  78. # Start DHCPv6 server?
  79. dhcp6=yes
  80. # Start DHCP DDNS server?
  81. dhcp_ddns=no
  82. # Start Control Agent?
  83. ctrl_agent=yes
  84. # Be verbose?
  85. kea_verbose=no
  86. </screen>
  87. </para>
  88. <para>
  89. The <parameter>dhcp4</parameter>, <parameter>dhcp6</parameter>,
  90. <parameter>dhcp_ddns</parameter> and <parameter>ctrl_agent</parameter>
  91. parameters set to "yes" configure <command>keactrl</command> to manage
  92. (start, reconfigure) all servers, i.e. <command>kea-dhcp4</command>,
  93. <command>kea-dhcp6</command>, <command>kea-dhcp-ddns</command> and
  94. <command>kea-ctrl-agent</command>. When any of these parameters is set
  95. to "no" the <command>keactrl</command> will ignore
  96. the corresponding server when starting or reconfiguring Kea.
  97. </para>
  98. <para>
  99. By default, Kea servers managed by <command>keactrl</command> are
  100. located in <filename>[kea-install-dir]/sbin</filename>. This
  101. should work for most installations. If the default
  102. location needs to be altered for any reason, the paths
  103. specified with the <parameter>dhcp4_srv</parameter>,
  104. <parameter>dhcp6_srv</parameter>, <parameter>dhcp_ddns_srv</parameter>
  105. and <parameter>ctrl_agent_srv</parameter> parameters should be modified.
  106. </para>
  107. <para>
  108. The <parameter>kea_verbose</parameter> parameter specifies the verbosity
  109. of the servers being started. When <parameter>kea_verbose</parameter>
  110. is set to "yes" the logging level of the server is set to DEBUG.
  111. Modification of the logging severity in a configuration file, as
  112. described in <xref linkend="logging"/>, will have no effect as long
  113. as the <parameter>kea_verbose</parameter> is set to "yes". Setting
  114. it to "no" will cause the server to use the logging levels specified
  115. in the Kea configuration file for respective loggers. If no
  116. logging configuration is specified, the default settings will be
  117. used.
  118. </para>
  119. <note>
  120. <para>
  121. The verbosity for the server is set when it is started. Once
  122. started, the verbosity can be only changed by stopping the server and
  123. starting it again with the new value of the
  124. <parameter>kea_verbose</parameter> parameter.
  125. </para>
  126. </note>
  127. </section>
  128. <section id="keactrl-commands">
  129. <title>Commands</title>
  130. <para>The following commands are supported by <command>keactrl</command>:
  131. <itemizedlist>
  132. <listitem><simpara>
  133. <command>start</command> - starts selected servers.
  134. </simpara></listitem>
  135. <listitem><simpara>
  136. <command>stop</command> - stops all running servers.
  137. </simpara></listitem>
  138. <listitem><simpara>
  139. <command>reload</command> - triggers reconfiguration of the
  140. selected servers by sending the SIGHUP signal to them.
  141. </simpara></listitem>
  142. <listitem><simpara>
  143. <command>status</command> - returns the status of the servers (active
  144. or inactive) and the names of the configuration files in use.
  145. </simpara></listitem>
  146. </itemizedlist>
  147. </para>
  148. <para>Typical output from <command>keactrl</command> when starting
  149. the servers looks similar to the following:
  150. <screen>
  151. <userinput>$ keactrl start</userinput>
  152. INFO/keactrl: Starting kea-dhcp4 -c /usr/local/etc/kea/kea-dhcp4.conf -d
  153. INFO/keactrl: Starting kea-dhcp6 -c /usr/local/etc/kea/kea-dhcp6.conf -d
  154. INFO/keactrl: Starting kea-dhcp-ddns -c /usr/local/etc/kea/kea-dhcp-ddns.conf -d
  155. INFO/keactrl: Starting kea-ctrl-agent -c /usr/local/etc/kea/kea-ctrl-agent.conf -d
  156. </screen>
  157. </para>
  158. <para>Kea's servers create PID files upon startup. These files are used
  159. by keactrl to determine whether or not a given server is running. If
  160. one or more servers are running when the start command is issued, the
  161. output will look similar to the following:
  162. <screen>
  163. <userinput>$ keactrl start</userinput>
  164. INFO/keactrl: kea-dhcp4 appears to be running, see: PID 10918, PID file: /usr/local/var/kea/kea.kea-dhcp4.pid.
  165. INFO/keactrl: kea-dhcp6 appears to be running, see: PID 10924, PID file: /usr/local/var/kea/kea.kea-dhcp6.pid.
  166. INFO/keactrl: kea-dhcp-ddns appears to be running, see: PID 10930, PID file: /usr/local/var/kea/kea.kea-dhcp-ddns.pid.
  167. INFO/keactrl: kea-ctrl-agent appears to be running, see: PID 10931, PID file: /usr/local/var/kea/kea.kea-ctrl-agent.pid.
  168. </screen>
  169. During normal shutdowns these PID files are deleted. They may, however,
  170. be left over as remnants following a system crash. It is possible,
  171. though highly unlikely, that upon system restart the PIDs they contain
  172. actually refer to processes unrelated to Kea. This condition will cause
  173. keactrl to decide that the servers are running, when in fact they are
  174. not. In such a case the PID files as listed in the keactrl output
  175. must be manually deleted.
  176. </para>
  177. <para>The following command stops all servers:
  178. <screen>
  179. <userinput>$ keactrl stop</userinput>
  180. INFO/keactrl: Stopping kea-dhcp4...
  181. INFO/keactrl: Stopping kea-dhcp6...
  182. INFO/keactrl: Stopping kea-dhcp-ddns...
  183. INFO/keactrl: Stopping kea-ctrl-agent...
  184. </screen>
  185. Note that the <command>stop</command> will attempt to stop all servers
  186. regardless of whether they are "enabled" in the <filename>keactrl.conf</filename>.
  187. If any of the servers are not running, an informational message
  188. is displayed as in the <command>stop</command> command output below.
  189. <screen>
  190. <userinput>$ keactrl stop</userinput>
  191. INFO/keactrl: kea-dhcp4 isn't running.
  192. INFO/keactrl: kea-dhcp6 isn't running.
  193. INFO/keactrl: kea-dhcp-ddns isn't running.
  194. INFO/keactrl: kea-ctrl-agent isn't running.
  195. </screen>
  196. </para>
  197. <para>
  198. As already mentioned, the reconfiguration of each Kea server is
  199. triggered by the SIGHUP signal. The <command>reload</command>
  200. command sends the SIGHUP signal to the servers that are enabled in
  201. the <command>keactrl</command> configuration file and are
  202. currently running. When a server receives the SIGHUP signal it
  203. re-reads its configuration file and, if the new configuration is
  204. valid, uses the new configuration. A reload is executed as follows:
  205. <screen>
  206. <userinput>$ keactrl reload</userinput>
  207. INFO/keactrl: Reloading kea-dhcp4...
  208. INFO/keactrl: Reloading kea-dhcp6...
  209. INFO/keactrl: Reloading kea-dhcp-ddns...
  210. INFO/keactrl: Reloading kea-ctrl-agent...
  211. </screen>
  212. If any of the servers are not running, an informational message
  213. is displayed as in the <command>reload</command> command output below.
  214. <screen>
  215. <userinput>$ keactrl stop</userinput>
  216. INFO/keactrl: kea-dhcp4 isn't running.
  217. INFO/keactrl: kea-dhcp6 isn't running.
  218. INFO/keactrl: kea-dhcp-ddns isn't running.
  219. INFO/keactrl: kea-ctrl-agent isn't running.
  220. </screen>
  221. </para>
  222. <note>
  223. <para>
  224. Currently <command>keactrl</command> does not report configuration
  225. failures when the server is started or reconfigured. To check if
  226. the server's configuration succeeded the Kea log must be examined
  227. for errors. By default, this is written to the syslog file.
  228. </para>
  229. </note>
  230. <para>
  231. Sometimes it is useful to check which servers are running. The
  232. <command>status</command> reports this, typical output looking like:
  233. <screen>
  234. <userinput>$ keactrl status</userinput>
  235. DHCPv4 server: active
  236. DHCPv6 server: inactive
  237. DHCP DDNS: active
  238. Control Agent: active
  239. Kea configuration file: /usr/local/etc/kea/kea.conf
  240. Kea DHCPv4 configuration file: /usr/local/etc/kea/kea-dhcp4.conf
  241. Kea DHCPv6 configuration file: /usr/local/etc/kea/kea-dhcp6.conf
  242. Kea DHCP DDNS configuration file: /usr/local/etc/kea/kea-dhcp-ddns.conf
  243. Kea Control Agent configuration file: /usr/local/etc/kea/kea-ctrl-agent.conf
  244. keactrl configuration file: /usr/local/etc/kea/keactrl.conf
  245. </screen>
  246. </para>
  247. </section>
  248. <section id="keactrl-overriding-servers">
  249. <title>Overriding the Server Selection</title>
  250. <para>
  251. The optional <command>-s</command> switch allows
  252. the selection of the servers to which <command>keactrl</command>
  253. command is issued. For example, the following
  254. instructs <command>keactrl</command> to stop the
  255. <command>kea-dhcp4</command> and <command>kea-dhcp6</command> servers
  256. and leave the <command>kea-dhcp-ddns</command> and
  257. <command>kea-ctrl-agent</command> running:
  258. <screen>
  259. <userinput>$ keactrl stop -s dhcp4,dhcp6</userinput>
  260. </screen>
  261. </para>
  262. <para>
  263. Similarly, the following
  264. will only start the <command>kea-dhcp4</command> and
  265. <command>kea-dhcp-ddns</command> servers and not:
  266. <command>kea-dhcp6</command>, <command>kea-ctrl-agent</command>.
  267. <screen>
  268. <userinput>$ keactrl start -s dhcp4,dhcp_ddns</userinput>
  269. </screen>
  270. </para>
  271. <para>
  272. Note that the behavior of the <command>-s</command> switch
  273. with the <command>start</command> and <command>reload</command> commands
  274. is different to its behavior with the <command>stop</command> command.
  275. On <command>start</command> and <command>reload</command>,
  276. <command>keactrl</command> will check if the servers given as
  277. parameters to the <command>-s</command> switch are
  278. enabled in the <command>keactrl</command> configuration file:
  279. if not, the server will be ignored. For <command>stop</command> however,
  280. this check is not made: the command is applied to all listed servers,
  281. regardless of whether they have been enabled in the file.
  282. </para>
  283. <para>
  284. The following keywords can be used with the <command>-s</command>
  285. command line option:
  286. <itemizedlist>
  287. <listitem><simpara>
  288. <command>dhcp4</command> for <command>kea-dhcp4.</command>
  289. </simpara></listitem>
  290. <listitem><simpara>
  291. <command>dhcp6</command> for <command>kea-dhcp6.</command>
  292. </simpara></listitem>
  293. <listitem><simpara>
  294. <command>dhcp_ddns</command> for <command>kea-dhcp-ddns.</command>
  295. </simpara></listitem>
  296. <listitem><simpara>
  297. <command>ctrl_agent</command> for <command>kea-ctrl-agent.</command>
  298. </simpara></listitem>
  299. <listitem><simpara>
  300. <command>all</command> for all servers (default).
  301. </simpara></listitem>
  302. </itemizedlist>
  303. </para>
  304. </section>
  305. </chapter>