<!--
 - Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 -
 - This Source Code Form is subject to the terms of the Mozilla Public
 - License, v. 2.0. If a copy of the MPL was not distributed with this
 - file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<!-- Converted by db4-upgrade version 1.1 -->
<refentry>
  <info>
    <productname>ISC Kea</productname>
    <date>Dec 14, 2018</date>
    <edition>1.5.0</edition>
    <author><personname/><contrib>The Kea software has been written by a number of
        engineers working for ISC: Tomek Mrugalski, Stephen Morris, Marcin
        Siodelski, Thomas Markwalder, Francis Dupont, Jeremy C. Reed,
        Wlodek Wencel and Shawn Routhier.  That list is roughly in the
        chronological order in which the authors made their first
        contribution. For a complete list of authors and
        contributors, see AUTHORS file.</contrib><orgname>Internet Systems Consortium, Inc.</orgname></author>
  </info>

  <refmeta>
    <refentrytitle>kea-admin</refentrytitle>
    <manvolnum>8</manvolnum>
    <refmiscinfo class="manual">Kea</refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname>kea-admin</refname>
    <refpurpose>Shell script for managing Kea databases</refpurpose>
  </refnamediv>

  <docinfo>
    <copyright>
      <year>2014-2018</year>
      <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
    </copyright>
  </docinfo>

  <refsynopsisdiv>
    <cmdsynopsis sepchar=" ">
      <command>kea-admin</command>
      <arg choice="opt" rep="norepeat">command</arg>
      <arg choice="opt" rep="norepeat">backend</arg>
      <arg choice="opt" rep="norepeat"><option>-u <replaceable class="parameter">database username</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">database password</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-n <replaceable class="parameter">database name</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-d <replaceable class="parameter">scripts directory</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-4 | -6</option></arg>
      <arg choice="opt" rep="norepeat"><option>-o <replaceable class="parameter">output file</replaceable></option></arg>
      <arg choice="opt" rep="norepeat"><option>-v</option></arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>DESCRIPTION</title>
    <para>
      kea-admin is a shell script which offers database maintenance. In particular,
      it features database initialization, database version checking and
      database schema upgrade.
    </para>
  </refsect1>

  <refsect1>
    <title>OPTIONS</title>
    <variablelist>
      <varlistentry>
        <term><option><replaceable class="parameter">command</replaceable></option></term>
        <listitem>
          <para>
            Command to be issued to the servers. It can be one of the following:
          </para>

          <variablelist>
            <varlistentry>
              <term>lease-init</term>
              <listitem>
                <para>Initializes a new lease database. Useful during first Kea
                installation. The database is initialized to the latest version
                supported by the version of the software.</para>
              </listitem>
            </varlistentry>

            <varlistentry>
              <term>lease-version</term>
              <listitem>
                <para>Reports lease database version. This is not necessarily
                equal to Kea version as each backend has its own versioning
                scheme.</para>
              </listitem>
            </varlistentry>

            <varlistentry>
              <term>lease-upgrade</term>
              <listitem>
                <para>Conducts lease database upgrade. This is useful when
                migrating between old and new Kea versions.</para>
              </listitem>
            </varlistentry>

            <varlistentry>
              <term>lease-dump</term>
              <listitem>
                <para>Dumps the contents of the lease database (MySQL and PostgreSQL
                backends) to text file. The content of the file consists of comma-separated-values
                (CSV) where each line in the file contains all of the values for a single lease.
                The first line of file is a header line containing the column names.</para>
              </listitem>
            </varlistentry>
          </variablelist>

        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option><replaceable class="parameter">backend</replaceable></option></term>
        <listitem>
          <para>
            Specifies backend type. Currently allowed backends are: memfile, mysql and
            pgsql.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-u|--user <replaceable class="parameter">username</replaceable></option></term>
        <listitem>
          <para>
            Specify the username when connecting to a database. If not specified,
            the default value of keatest is used.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-p|--password <replaceable class="parameter">password</replaceable></option></term>
        <listitem>
          <para>
            Specifies the password when connecting to a database. If not specified,
            the default value of keatest is used.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-n|--name <replaceable class="parameter">database-name</replaceable></option></term>
        <listitem>
          <para>
            Specifies the database name to connect to. If not specified,
            the default value of keatest is used.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-d|--directory <replaceable class="parameter">script-directory</replaceable></option></term>
        <listitem>
          <para>
            Used for override scripts directory. That script is used during upgrades,
            database initialization and possibly other operations. If not specified,
            the default value of (prefix)/share/kea/scripts/ is used.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-o|--output <replaceable class="parameter">output_file</replaceable></option></term>
        <listitem>
          <para>
            Required for lease-dump, Specifies the file to which the lease data will be dumped.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-v|--version</option></term>
        <listitem>
          <para>
            Prints kea-admin version and quits.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-4</option></term>
        <listitem>
          <para>
            Directs kea-admin to lease-dump the DHCPv4 leases. Incompatible with the -6 option.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-6</option></term>
        <listitem>
          <para>
            Directs kea-admin to lease-dump the DHCPv6 leases. Incompatible with the -4 option.
          </para>
        </listitem>
      </varlistentry>

    </variablelist>

  </refsect1>

  <refsect1>
    <title>SEE ALSO</title>
    <para>
      <citerefentry>
        <refentrytitle>keactrl</refentrytitle>
        <manvolnum>8</manvolnum>
      </citerefentry>,

      <citerefentry>
        <refentrytitle>kea-dhcp4</refentrytitle>
        <manvolnum>8</manvolnum>
      </citerefentry>,

      <citerefentry>
        <refentrytitle>kea-dhcp6</refentrytitle>
        <manvolnum>8</manvolnum>
      </citerefentry>,

      <citerefentry>
        <refentrytitle>kea-dhcp-ddns</refentrytitle>
        <manvolnum>8</manvolnum>
      </citerefentry>,

      <citerefentry>
        <refentrytitle>kea-ctrl-agent</refentrytitle>
        <manvolnum>8</manvolnum>
      </citerefentry>,

      <citerefentry>
        <refentrytitle>kea-netconf</refentrytitle>
        <manvolnum>8</manvolnum>
      </citerefentry>,

      <citerefentry>
        <refentrytitle>keactrl</refentrytitle>
        <manvolnum>8</manvolnum>
      </citerefentry>,

      <citerefentry>
        <refentrytitle>perfdhcp</refentrytitle>
        <manvolnum>8</manvolnum>
      </citerefentry>,

      <citetitle>Kea Administrator Guide</citetitle>.

    </para>
  </refsect1>

</refentry>
