"parameters": { }
},
{
- // The MySql host backend hook library required for host storage.
+ // The MySQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
},
{
- // The PgSql host backend hook library required for host storage.
+ // The PostgreSQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
}
],
"parameters": { }
},
{
- // The MySql host backend hook library required for host storage.
+ // The MySQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
},
{
- // The PgSql host backend hook library required for host storage.
+ // The PostgreSQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
}
],
// "retry-on-startup": false,
// "connect-timeout": 3
// },
+// Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
+// store leases in the MySQL Lease Database Backend.
+// Specify the lease backend hook library location.
+// {
+// // the MySQL lease backend hook library required for lease storage.
+// "library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
+// },
// 3. PostgreSQL backend. Leases will be stored in PostgreSQL database. Make
// sure it is up, running and properly initialized. See kea-admin documentation
// "retry-on-startup": false,
// "connect-timeout": 3
// },
+// Since Kea.2.7.4, the libdhcp_pgsql.so hook library must be loaded in order to
+// store leases in the PostgreSQL Lease Database Backend.
+// Specify the lease backend hook library location.
+// {
+// // the PostgreSQL lease backend hook library required for lease storage.
+// "library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
+// },
// Addresses will be assigned with a lifetime of 4000 seconds.
"valid-lifetime": 4000,
// This is an example configuration file for the DHCPv4 server in Kea.
// It demonstrates how to enable Kea Configuration Backend using MySQL.
-// It requires that libdhcp_mysql_cb.so library is available and
+// It requires that libdhcp_mysql.so library is available and
// optionally libdhcp_cb_cmds.so hook library.
{ "Dhcp4":
},
// This parameter controls how the server accesses the configuration
- // database. Currently only one database type is available - "mysql".
- // It requires that the libdhcp_mysql_cb.so hook library is loaded.
+ // database. Currently only two database types are available - "mysql" and
+ // "postgresql".
+ // Using "mysql" requires that the libdhcp_mysql.so hook library is loaded.
+ // If using "postgresql", then loading libdhcp_pgsql.so hook library is
+ // required.
"config-control": {
// A list of database backends to connect to. Currently, it is limited
// to a single backend.
// Hooks libraries that enable configuration backend are loaded.
"hooks-libraries": [
- // The libdhcp_mysql_cb.so is required to use MySQL Configuration
+ // The libdhcp_mysql.so is required to use MySQL Configuration
// Backend.
{
- "library": "/usr/local/lib/kea/hooks/libdhcp_mysql_cb.so"
+ "library": "/usr/local/lib/kea/hooks/libdhcp_mysql.so"
}
+ // If using PostgreSQL Configuration Backend, the "libdhcp_pgsql.so" is
+ // required.
+ // {
+ // "library": "/usr/local/lib/kea/hooks/libdhcp_pgsql.so"
+ // }
// The libdhcp_cb_cmds.so is optional. It allows for managing the
// configuration in the database. If this library is not loaded,
// the configuration can be managed directly using available
"key-file": "my-key",
"cipher-list": "AES"
},
-
+// Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
+// store host reservations in the MySQL Host Database Backend.
// Specify the host backend hook library location.
"hooks-libraries": [
{
- // the MySql host backend hook library required for host storage.
+ // the MySQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
}
],
"host": "localhost"
}
],
-
+// Since Kea.2.7.4, the libdhcp_pgsql.so hook library must be loaded in order to
+// store host reservations in the PostgreSQL Host Database Backend.
// Specify the host backend hook library location.
"hooks-libraries": [
{
- // the PgSql host backend hook library required for host storage.
+ // the PostgreSQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
}
],
"parameters": { }
},
{
- // The MySql host backend hook library required for host storage.
+ // The MySQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
},
{
- // The PgSql host backend hook library required for host storage.
+ // The PostgreSQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
}
],
"parameters": { }
},
{
- // The MySql host backend hook library required for host storage.
+ // The MySQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
},
{
- // The PgSql host backend hook library required for host storage.
+ // The PostgreSQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
}
],
"prefixes": [ "2001:db8:2:abcd::/64" ],
// List of excluded IPv6 prefixes.
- "excluded-prefixes": [ "2001:db8:2:abcd:1::/80" ],
+ "excluded-prefixes": [ "2001:db8:2:abcd:1::/80" ],
// Reserved hostname.
"hostname": "foo.example.com",
// "retry-on-startup": false,
// "connect-timeout": 3
// },
+// Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
+// store leases in the MySQL Lease Database Backend.
+// Specify the lease backend hook library location.
+// {
+// // the MySQL lease backend hook library required for lease storage.
+// "library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
+// },
// 3. PostgreSQL backend. Leases will be stored in PostgreSQL database. Make
// sure it is up, running and properly initialized. See kea-admin documentation
// "retry-on-startup": false,
// "connect-timeout": 3
// },
+// Since Kea.2.7.4, the libdhcp_pgsql.so hook library must be loaded in order to
+// store leases in the PostgreSQL Lease Database Backend.
+// Specify the lease backend hook library location.
+// {
+// // the PostgreSQL lease backend hook library required for lease storage.
+// "library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
+// },
// Addresses will be assigned with preferred and valid lifetimes
// being 3000 and 4000, respectively. Client is told to start
// This is an example configuration file for the DHCPv4 server in Kea.
// It demonstrates how to enable Kea Configuration Backend using MySQL.
-// It requires that libdhcp_mysql_cb.so library is available and
+// It requires that libdhcp_mysql.so library is available and
// optionally libdhcp_cb_cmds.so hook library.
{ "Dhcp6":
},
// This parameter controls how the server accesses the configuration
- // database. Currently only one database type is available - "mysql".
- // It requires that libdhcp_mysql_cb.so hook library is loaded.
+ // database. Currently only two database types are available - "mysql" and
+ // "postgresql".
+ // Using "mysql" requires that the libdhcp_mysql.so hook library is loaded.
+ // If using "postgresql", then loading libdhcp_pgsql.so hook library is
+ // required.
"config-control": {
// A list of database backends to connect to. Currently, it is limited
// to a single backend.
// Hooks libraries that enable configuration backend are loaded.
"hooks-libraries": [
- // The libdhcp_mysql_cb.so is required to use MySQL Configuration
+ // The libdhcp_mysql.so is required to use MySQL Configuration
// Backend.
{
- "library": "/usr/local/lib/kea/hooks/libdhcp_mysql_cb.so"
+ "library": "/usr/local/lib/kea/hooks/libdhcp_mysql.so"
}
+ // If using PostgreSQL Configuration Backend, the "libdhcp_pgsql.so" is
+ // required.
+ // {
+ // "library": "/usr/local/lib/kea/hooks/libdhcp_pgsql.so"
+ // }
// The libdhcp_cb_cmds.so is optional. It allows for managing the
// configuration in the database. If this library is not loaded,
// the configuration can be managed directly using available
"key-file": "my-key",
"cipher-list": "AES"
},
-
+// Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
+// store host reservations in the MySQL Host Database Backend.
// Specify the host backend hook library location.
"hooks-libraries": [
{
- // the MySql host backend hook library required for host storage.
+ // the MySQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
}
],
"host": "localhost"
}
],
-
+// Since Kea.2.7.4, the libdhcp_pgsql.so hook library must be loaded in order to
+// store host reservations in the PostgreSQL Host Database Backend.
// Specify the host backend hook library location.
"hooks-libraries": [
{
- // the PgSql host backend hook library required for host storage.
+ // the PostgreSQL host backend hook library required for host storage.
"library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
}
],
the particular Kea module providing support to manage and fetch the
configuration information from the particular database type. For
example, the MySQL Configuration Backend is the logic implemented within
-:ischooklib:`libdhcp_mysql_cb.so`, which provides a complete set of functions to
+:ischooklib:`libdhcp_mysql.so`, which provides a complete set of functions to
manage and fetch the configuration information from the MySQL database.
The PostgreSQL Configuration Backend is the logic implemented within
-:ischooklib:`libdhcp_pgsql_cb.so`, which provides a complete set of functions to
+:ischooklib:`libdhcp_pgsql.so`, which provides a complete set of functions to
manage and fetch the configuration information from the PostgreSQL database.
From here on, the term "database" is used to refer to either a MySQL or
PostgreSQL database.
CB Components
-------------
-To use a MySQL configuration backend, :ischooklib:`libdhcp_mysql_cb.so`
-must be compiled and the DHCP servers must be configured to load it.
-It is compiled when the ``--with-mysql`` configuration switch is used during the Kea build.
-The MySQL C client libraries must be installed, as explained in :ref:`dhcp-install-configure`.
-
-To use a PostgreSQL configuration backend, :ischooklib:`libdhcp_pgsql_cb.so` must
-be compiled and the DHCP servers must be configured to load it. It is compiled when
-the ``--with-pgsql`` configuration switch is used during the Kea build. The PostgreSQL
-C client libraries must be installed, as explained in :ref:`dhcp-install-configure`.
+To use a MySQL configuration backend, :ischooklib:`libdhcp_mysql.so` must
+be compiled and the DHCP servers must be configured to load it. It is compiled
+when the ``--with-mysql`` configuration switch is used during the Kea build.
+The MySQL C client libraries must be installed, as explained in
+:ref:`dhcp-install-configure`.
+
+To use a PostgreSQL configuration backend, :ischooklib:`libdhcp_pgsql.so` must
+be compiled and the DHCP servers must be configured to load it. It is compiled
+when the ``--with-pgsql`` configuration switch is used during the Kea build.
+The PostgreSQL C client libraries must be installed, as explained in
+:ref:`dhcp-install-configure`.
.. note::
``host`` parameter is ``localhost``, but establishes a TCP connection
for ``127.0.0.1``.
+Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
+store leases in the MySQL Lease Database Backend.
+Specify the lease backend hook library location:
+
+::
+
+ "Dhcp4": { "hooks-libraries": [
+ {
+ // the MySQL lease backend hook library required for lease storage.
+ "library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
+ }, ... ], ... }
+
+Since Kea.2.7.4, the libdhcp_pgsql.so hook library must be loaded in order to
+store leases in the PostgreSQL Lease Database Backend.
+Specify the lease backend hook library location.
+
+::
+
+ "Dhcp4": { "hooks-libraries": [
+ {
+ // the PostgreSQL lease backend hook library required for lease storage.
+ "library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
+ }, ... ], ... }
+
.. _hosts4-storage:
The ``readonly`` parameter is only supported for MySQL and
PostgreSQL databases.
+Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
+store host reservations in the MySQL Host Database Backend.
+Specify the lease backend hook library location:
+
+::
+
+ "Dhcp4": { "hooks-libraries": [
+ {
+ // the MySQL host backend hook library required for host storage.
+ "library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
+ }, ... ], ... }
+
+Since Kea.2.7.4, the libdhcp_pgsql.so hook library must be loaded in order to
+store host reservations in the PostgreSQL Host Database Backend.
+Specify the lease backend hook library location.
+
+::
+
+ "Dhcp4": { "hooks-libraries": [
+ {
+ // the PostgreSQL host backend hook library required for host storage.
+ "library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
+ }, ... ], ... }
+
Tuning Database Timeouts for Hosts Storage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: json
{
- "Dhcp4": {
- "server-tag": "my DHCPv4 server",
- "config-control": {
- "config-databases": [
- {
- "type": "mysql",
- "name": "kea",
- "user": "kea",
- "password": "kea",
- "host": "192.0.2.1",
- "port": 3302
- }
- ],
- "config-fetch-wait-time": 20
- },
- "hooks-libraries": [
- {
- "library": "/usr/local/lib/kea/hooks/libdhcp_mysql_cb.so"
- }, {
- "library": "/usr/local/lib/kea/hooks/libdhcp_cb_cmds.so"
+ "Dhcp4": {
+ "server-tag": "my DHCPv4 server",
+ "config-control": {
+ "config-databases": [
+ {
+ "type": "mysql",
+ "name": "kea",
+ "user": "kea",
+ "password": "kea",
+ "host": "192.0.2.1",
+ "port": 3302
+ }
+ ],
+ "config-fetch-wait-time": 20
+ },
+ "hooks-libraries": [
+ {
+ "library": "/usr/local/lib/kea/hooks/libdhcp_mysql.so"
+ },
+ {
+ "library": "/usr/local/lib/kea/hooks/libdhcp_cb_cmds.so"
+ }
+ ]
+ }
+ }
+
+The following snippet illustrates the use of a PostgreSQL database:
+
+.. code-block:: json
+
+ {
+ "Dhcp4": {
+ "server-tag": "my DHCPv4 server",
+ "config-control": {
+ "config-databases": [
+ {
+ "type": "postgresql",
+ "name": "kea",
+ "user": "kea",
+ "password": "kea",
+ "host": "192.0.2.1",
+ "port": 3302
+ }
+ ],
+ "config-fetch-wait-time": 20
+ },
+ "hooks-libraries": [
+ {
+ "library": "/usr/local/lib/kea/hooks/libdhcp_pgsql.so"
+ },
+ {
+ "library": "/usr/local/lib/kea/hooks/libdhcp_cb_cmds.so"
+ }
+ ]
}
- ]
- }
}
The ``config-control`` map contains two parameters. ``config-databases``
available for this server from the database. This configuration is
merged into the configuration read from the configuration file.
-The following snippet illustrates the use of a PostgreSQL database:
-
-.. code-block:: json
-
- {
- "Dhcp4": {
- "server-tag": "my DHCPv4 server",
- "config-control": {
- "config-databases": [
- {
- "type": "postgresql",
- "name": "kea",
- "user": "kea",
- "password": "kea",
- "host": "192.0.2.1",
- "port": 5432
- }
- ],
- "config-fetch-wait-time": 20
- },
- "hooks-libraries": [
- {
- "library": "/usr/local/lib/kea/hooks/libdhcp_pgsql_cb.so"
- }, {
- "library": "/usr/local/lib/kea/hooks/libdhcp_cb_cmds.so"
- }
- ]
- }
- }
-
.. note::
Whenever there is a conflict between the parameters specified in the
In the configuration examples above, two hook libraries are loaded. The first
is a library which implements the configuration backend for a specific database
-type: :ischooklib:`libdhcp_mysql_cb.so` provides support for MySQL and :ischooklib:`libdhcp_pgsql_cb.so`
-provides support for PostgreSQL. The library loaded must match the database
-``type`` specified within the ``config-control`` parameter; otherwise an error
-is logged when the server attempts to load its configuration, and the load
-fails.
+type: :ischooklib:`libdhcp_mysql.so` provides support for MySQL and
+:ischooklib:`libdhcp_pgsql.so` provides support for PostgreSQL. The library
+loaded must match the database ``type`` specified within the ``config-control``
+parameter; otherwise an error is logged when the server attempts to load its
+configuration, and the load fails.
The second hook library, :ischooklib:`libdhcp_cb_cmds.so`, is optional. It should
be loaded when the Kea server instance is to be used to manage the
``host`` parameter is ``localhost``, but establishes a TCP connection
for ``127.0.0.1``.
+Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
+store leases in the MySQL Lease Database Backend.
+Specify the lease backend hook library location:
+
+::
+
+ "Dhcp6": { "hooks-libraries": [
+ {
+ // the MySQL lease backend hook library required for lease storage.
+ "library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
+ }, ... ], ... }
+
+Since Kea.2.7.4, the libdhcp_pgsql.so hook library must be loaded in order to
+store leases in the PostgreSQL Lease Database Backend.
+Specify the lease backend hook library location.
+
+::
+
+ "Dhcp6": { "hooks-libraries": [
+ {
+ // the PostgreSQL lease backend hook library required for lease storage.
+ "library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
+ }, ... ], ... }
+
.. _hosts6-storage:
The ``readonly`` parameter is only supported for MySQL and
PostgreSQL databases.
+Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
+store host reservations in the MySQL Host Database Backend.
+Specify the lease backend hook library location:
+
+::
+
+ "Dhcp6": { "hooks-libraries": [
+ {
+ // the MySQL host backend hook library required for host storage.
+ "library": "/opt/lib/kea/hooks/libdhcp_mysql.so"
+ }, ... ], ... }
+
+Since Kea.2.7.4, the libdhcp_pgsql.so hook library must be loaded in order to
+store host reservations in the PostgreSQL Host Database Backend.
+Specify the lease backend hook library location.
+
+::
+
+ "Dhcp6": { "hooks-libraries": [
+ {
+ // the PostgreSQL host backend hook library required for host storage.
+ "library": "/opt/lib/kea/hooks/libdhcp_pgsql.so"
+ }, ... ], ... }
+
Tuning Database Timeouts for Hosts Storage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
"Dhcp6": {
- "server-tag": "my DHCPv6 server",
+ "server-tag": "my DHCPv6 server",
"config-control": {
"config-databases": [
{
},
"hooks-libraries": [
{
- "library": "/usr/local/lib/kea/hooks/libdhcp_mysql_cb.so"
+ "library": "/usr/local/lib/kea/hooks/libdhcp_mysql.so"
+ },
+ {
+ "library": "/usr/local/lib/kea/hooks/libdhcp_cb_cmds.so"
+ }
+ ]
+ }
+ }
+
+The following snippet illustrates the use of a PostgreSQL database:
+
+.. code-block:: json
+
+ {
+ "Dhcp6": {
+ "server-tag": "my DHCPv6 server",
+ "config-control": {
+ "config-databases": [
+ {
+ "type": "postgresql",
+ "name": "kea",
+ "user": "kea",
+ "password": "kea",
+ "host": "2001:db8:1::1",
+ "port": 3302
+ }
+ ],
+ "config-fetch-wait-time": 20
+ },
+ "hooks-libraries": [
+ {
+ "library": "/usr/local/lib/kea/hooks/libdhcp_pgsql.so"
},
{
"library": "/usr/local/lib/kea/hooks/libdhcp_cb_cmds.so"
``libdhcp_cb_cmds.so``: Configuration Backend Commands
======================================================
-This hook library is used to manage Kea
-servers' configurations in a configuration backend database. This library must
-be used in conjunction with the available CB hook libraries implementing
-the common APIs to create, read, update, and delete (CRUD) the
-configuration information in the respective databases. For example:
-:ischooklib:`libdhcp_mysql_cb.so` implements this API for MySQL while
-:ischooklib:`libdhcp_pgsql_cb.so` implements this API for PostgreSQL.
+This hook library is used to manage Kea servers' configurations in a
+configuration backend database. This library must be used in conjunction with
+the available CB hook libraries implementing the common APIs to create, read,
+update, and delete (CRUD) the configuration information in the respective
+databases. For example: :ischooklib:`libdhcp_mysql.so` implements this API for
+MySQL while :ischooklib:`libdhcp_pgsql.so` implements this API for PostgreSQL.
To manage the configuration information in a MySQL database, both
-:ischooklib:`libdhcp_mysql_cb.so` and :ischooklib:`libdhcp_cb_cmds.so`
-must be loaded by the server used for configuration management.
+:ischooklib:`libdhcp_mysql.so` and :ischooklib:`libdhcp_cb_cmds.so` must be
+loaded by the server used for configuration management.
To manage the configuration information in a PostgreSQL database, both
-:ischooklib:`libdhcp_pgsql_cb.so` and :ischooklib:`libdhcp_cb_cmds.so`
-must be loaded by the server used for configuration management.
+:ischooklib:`libdhcp_pgsql.so` and :ischooklib:`libdhcp_cb_cmds.so` must be
+loaded by the server used for configuration management.
More information on how to configure the Configuration Backend hook library for
use with a MySQL or PostgreSQL database can be found in the :ref:`dhcp4-cb`
+++ /dev/null
-.. ischooklib:: libdhcp_mysql_cb.so
-.. _hooks-cb-mysql:
-
-``libdhcp_mysql_cb.so``: Configuration Backend for MySQL
-========================================================
-
-This hook library works in conjunction with :ischooklib:`libdhcp_cb_cmds.so` to
-implement the API to create, read, update, and delete (CRUD) the
-configuration in a MySQL database. Please see :ref:`hooks-cb-cmds`
-for more details.
-
-.. note::
-
- :ischooklib:`libdhcp_mysql_cb.so` is part of the open source code and is
- available to every Kea user. However, this hook library only works
- with :ischooklib:`libdhcp_cb_cmds.so`, which allows easy configuration
- management with the use of API commands. :ischooklib:`libdhcp_cb_cmds.so`
- is available only to ISC customers with a paid support contract; for more information
- on subscription options, please complete the form at https://www.isc.org/contact.
+++ /dev/null
-.. ischooklib:: libdhcp_pgsql_cb.so
-.. _hooks-cb-pgsql:
-
-``libdhcp_pgsql_cb.so``: Configuration Backend for PostgreSQL
-=============================================================
-
-This hook library works in conjunction with :ischooklib:`libdhcp_cb_cmds.so` to
-implement the API to create, read, update, and delete (CRUD) the
-configuration in a PostgreSQL database. Please see :ref:`hooks-cb-cmds`
-for more details.
-
-.. note::
-
- :ischooklib:`libdhcp_pgsql_cb.so` is part of the open source code and is
- available to every Kea user. However, this hook library only works
- with :ischooklib:`libdhcp_cb_cmds.so`, which allows easy configuration
- management with the use of API commands. :ischooklib:`libdhcp_cb_cmds.so`
- is available only to ISC customers with a paid support contract; for more information
- on subscription options, please complete the form at https://www.isc.org/contact.
--- /dev/null
+.. ischooklib:: libdhcp_mysql.so
+.. _hooks-mysql:
+
+``libdhcp_mysql.so``: Database Backend for MySQL
+================================================
+
+This hook library implements MySQL database storage for:
+ - Lease Backend
+ - Host Backend
+ - Configuration Backend
+
+This hook library works in conjunction with :ischooklib:`libdhcp_cb_cmds.so` to
+implement the API to create, read, update, and delete (CRUD) the configuration
+in a MySQL database. Please see :ref:`hooks-cb-cmds` for more details.
+
+.. note::
+
+ :ischooklib:`libdhcp_mysql.so` is part of the open source code and is
+ available to every Kea user. However, this hook library only works with
+ :ischooklib:`libdhcp_cb_cmds.so`, which allows easy configuration
+ management with the use of API commands. :ischooklib:`libdhcp_cb_cmds.so`
+ is available only to ISC customers with a paid support contract; for more
+ information on subscription options, please complete the form at
+ https://www.isc.org/contact.
--- /dev/null
+.. ischooklib:: libdhcp_pgsql.so
+.. _hooks-pgsql:
+
+``libdhcp_pgsql.so``: Database Backend for PostgreSQL
+=====================================================
+
+This hook library implements PostgreSQL database storage for:
+ - Lease Backend
+ - Host Backend
+ - Configuration Backend
+
+This hook library works in conjunction with :ischooklib:`libdhcp_cb_cmds.so` to
+implement the API to create, read, update, and delete (CRUD) the configuration
+in a PostgreSQL database. Please see :ref:`hooks-cb-cmds` for more details.
+
+.. note::
+
+ :ischooklib:`libdhcp_pgsql.so` is part of the open source code and is
+ available to every Kea user. However, this hook library only works with
+ :ischooklib:`libdhcp_cb_cmds.so`, which allows easy configuration
+ management with the use of API commands. :ischooklib:`libdhcp_cb_cmds.so`
+ is available only to ISC customers with a paid support contract; for more
+ information on subscription options, please complete the form at
+ https://www.isc.org/contact.
| | | which packets receive a response. The limit can be applied |
| | | per-client class or per-subnet. |
+-----------------------------------------------------------+--------------+--------------------------------------------------------------+
- | :ref:`MySQL Configuration Backend <hooks-cb-mysql>` | Kea open | This hook library is an implementation of the Kea |
- | | source | Configuration Backend for MySQL. It uses a MySQL database as |
- | | | a repository for the Kea configuration information. Kea |
- | | | servers use this library to fetch their configurations. |
+ | :ref:`MySQL Configuration Backend <hooks-mysql>` | Kea open | This hook library is an implementation of the Kea Lease, |
+ | | source | Host and Configuration Backend for MySQL. It uses a |
+ | | | MySQL database as a repository for the Kea leases, host |
+ | | | reservations and configuration information. Kea servers use |
+ | | | this library to fetch their configurations if Configuration |
+ | | | Backend is used. |
+-----------------------------------------------------------+--------------+--------------------------------------------------------------+
| :ref:`PerfMon <hooks-perfmon>` | Kea open | With this hook library, :iscman:`kea-dhcp4` and |
| CURRENTLY EXPERIMENTAL | source | :iscman:`kea-dhcp6` servers can track and report performance |
| | source | perform ping checks of candidate lease addresses before |
| | customers | offering them to clients. |
+-----------------------------------------------------------+--------------+--------------------------------------------------------------+
- | :ref:`PostgreSQL Configuration Backend <hooks-cb-pgsql>` | Kea open | This hook library is an implementation of the Kea |
- | | source | Configuration Backend for PostgreSQL. It uses a PostgreSQL |
- | | | database as a repository for the Kea configuration |
- | | | information. Kea servers use this library to fetch their |
- | | | configurations. |
+ | :ref:`PostgreSQL Database Backend <hooks-pgsql>` | Kea open | This hook library is an implementation of the Kea Lease, |
+ | | source | Host and Configuration Backend for PostgreSQL. It uses a |
+ | | | PostgreSQL database as a repository for the Kea leases, host |
+ | | | reservations and configuration information. Kea servers use |
+ | | | this library to fetch their configurations if Configuration |
+ | | | Backend is used. |
+-----------------------------------------------------------+--------------+--------------------------------------------------------------+
| :ref:`RADIUS <hooks-radius>` | ISC support | The RADIUS hook library allows Kea to interact with |
| | customers | RADIUS servers using access and accounting mechanisms. The |
.. include:: hooks-lease-query.rst
.. include:: hooks-legal-log.rst
.. include:: hooks-limits.rst
-.. include:: hooks-cb-mysql.rst
+.. include:: hooks-mysql.rst
.. include:: hooks-perfmon.rst
.. include:: hooks-ping-check.rst
-.. include:: hooks-cb-pgsql.rst
+.. include:: hooks-pgsql.rst
.. include:: hooks-radius.rst
.. include:: hooks-rbac.rst
.. include:: hooks-run-script.rst
| | | Forensic Logging |
| | | hook library. |
+----------------------------------+---------------------------------------+--------------------------------+
- | ``kea-dhcp4.mysql-cb-hooks``, | :ischooklib:`libdhcp_mysql_cb.so` | Used |
+ | ``kea-dhcp4.mysql-cb-hooks``, | :ischooklib:`libdhcp_mysql.so` | Used |
| ``kea-dhcp6.mysql-cb-hooks`` | open-source hook library | to log messages |
| | | related to the |
| | | operation of the |
| | | Backend hook |
| | | library. |
+----------------------------------+---------------------------------------+--------------------------------+
+ | ``kea-dhcp4.mysql-hb-hooks``, | :ischooklib:`libdhcp_mysql.so` | Used |
+ | ``kea-dhcp6.mysql-hb-hooks`` | open-source hook library | to log messages |
+ | | | related to the |
+ | | | operation of the |
+ | | | MySQL Host |
+ | | | Backend hook |
+ | | | library. |
+ +----------------------------------+---------------------------------------+--------------------------------+
+ | ``kea-dhcp4.mysql-lb-hooks``, | :ischooklib:`libdhcp_mysql.so` | Used |
+ | ``kea-dhcp6.mysql-lb-hooks`` | open-source hook library | to log messages |
+ | | | related to the |
+ | | | operation of the |
+ | | | MySQL Lease |
+ | | | Backend hook |
+ | | | library. |
+ +----------------------------------+---------------------------------------+--------------------------------+
| ``kea-dhcp4.options``, | core | Used by the DHCP |
| ``kea-dhcp6.options`` | | server to log |
| | | messages related to |
| | | the operation of the Ping |
| | | Check hook library. |
+----------------------------------+---------------------------------------+--------------------------------+
- | ``kea-dhcp4.pgsql-cb-hooks``, | :ischooklib:`libdhcp_pgsql_cb.so` | Used |
+ | ``kea-dhcp4.pgsql-cb-hooks``, | :ischooklib:`libdhcp_pgsql.so` | Used |
| ``kea-dhcp6.pgsql-cb-hooks`` | open-source hook library | to log messages |
| | | related to the |
| | | operation of the |
| | | Backend hook |
| | | library. |
+----------------------------------+---------------------------------------+--------------------------------+
+ | ``kea-dhcp4.pgsql-hb-hooks``, | :ischooklib:`libdhcp_pgsql.so` | Used |
+ | ``kea-dhcp6.pgsql-hb-hooks`` | open-source hook library | to log messages |
+ | | | related to the |
+ | | | operation of the |
+ | | | PostgreSQL Host |
+ | | | Backend hook |
+ | | | library. |
+ +----------------------------------+---------------------------------------+--------------------------------+
+ | ``kea-dhcp4.pgsql-lb-hooks``, | :ischooklib:`libdhcp_pgsql.so` | Used |
+ | ``kea-dhcp6.pgsql-lb-hooks`` | open-source hook library | to log messages |
+ | | | related to the |
+ | | | operation of the |
+ | | | PostgreSQL Lease |
+ | | | Backend hook |
+ | | | library. |
+ +----------------------------------+---------------------------------------+--------------------------------+
| ``kea-dhcp4.run-script-hooks``, | :ischooklib:`libdhcp_run_script.so` | Used to log messages related |
| ``kea-dhcp6.run-script-hooks`` | open-source hook library | to the operation of the |
| | | Run Script hook library. |
rst_arm_sources += arm/hooks-lease-cmds.rst
rst_arm_sources += arm/hooks-lease-query.rst
rst_arm_sources += arm/hooks-limits.rst
-rst_arm_sources += arm/hooks-cb-mysql.rst
-rst_arm_sources += arm/hooks-cb-pgsql.rst
+rst_arm_sources += arm/hooks-mysql.rst
+rst_arm_sources += arm/hooks-pgsql.rst
rst_arm_sources += arm/hooks-legal-log.rst
rst_arm_sources += arm/hooks-perfmon.rst
rst_arm_sources += arm/hooks-ping-check.rst
'arm/hooks-legal-log.rst',
'arm/hooks-gss-tsig.rst',
'arm/hooks-host-cmds.rst',
- 'arm/hooks-cb-mysql.rst',
- 'arm/hooks-cb-pgsql.rst',
+ 'arm/hooks-mysql.rst',
+ 'arm/hooks-pgsql.rst',
'arm/hooks-limits.rst',
'arm/hooks-rbac.rst',
'arm/hooks-run-script.rst',
// Should fail because "type=mysql" has no factories.
configure(config, CONTROL_RESULT_ERROR,
"during update from config backend database: "
- "The type of the configuration backend: "
- "'mysql' is not supported");
+ "The Kea server has not been compiled with support for database "
+ "type: mysql. Did you forget to use --with-mysql during "
+ "compilation or to load libdhcp_mysql hook library?");
}
// This test verifies that configuration control info gets populated.
// Should fail because "type=mysql" has no factories.
configure(config, CONTROL_RESULT_ERROR,
"during update from config backend database: "
- "The type of the configuration backend: "
- "'mysql' is not supported");
+ "The Kea server has not been compiled with support for database "
+ "type: mysql. Did you forget to use --with-mysql during "
+ "compilation or to load libdhcp_mysql hook library?");
}
// This test verifies that configuration control info gets populated.
// "parameters": {
// "identifier-expression": "relay4[2].hex"
// }
+ // },
+ // {
+ // // the MySQL host backend hook library required for host storage.
+ // "library": "@libdir@/kea/hooks/libdhcp_mysql.so"
// }
// ],
// "parameters": {
// "identifier-expression": "relay6[0].option[37].hex"
// }
+ // },
+ // {
+ // // the MySQL host backend hook library required for host storage.
+ // "library": "@libdir@/kea/hooks/libdhcp_mysql.so"
// }
// ],
class MySqlConfigBackendDHCPv4Impl;
-/// @brief Implementation of the MySql Configuration Backend for
+/// @brief Implementation of the MySQL Configuration Backend for
/// Kea DHCPv4 server.
///
/// All POSIX times specified in the methods belonging to this
class MySqlConfigBackendDHCPv6Impl;
-/// @brief Implementation of the MySql Configuration Backend for
+/// @brief Implementation of the MySQL Configuration Backend for
/// Kea DHCPv6 server.
///
/// All POSIX times specified in the methods belonging to this
my_bool user_context_null_; ///< Used when user context is null
};
-/// @brief MySql derivation of the statistical lease data query
+/// @brief MySQL derivation of the statistical lease data query
///
/// This class is used to recalculate lease statistics for MySQL
/// lease storage. It does so by executing a query which returns a result
class PgSqlConfigBackendDHCPv4Impl;
-/// @brief Implementation of the PgSql Configuration Backend for
+/// @brief Implementation of the PostgreSQL Configuration Backend for
/// Kea DHCPv4 server.
///
/// All POSIX times specified in the methods belonging to this
class PgSqlConfigBackendDHCPv6Impl;
-/// @brief Implementation of the PgSql Configuration Backend for
+/// @brief Implementation of the PostgreSQL Configuration Backend for
/// Kea DHCPv6 server.
///
/// All POSIX times specified in the methods belonging to this
//@}
};
-/// @brief Base PgSql derivation of the statistical lease data query
+/// @brief Base PostgreSQL derivation of the statistical lease data query
///
/// This class provides the functionality such as results storage and row
/// fetching common to fulfilling the statistical lease data query.
// No match?
if (index == factories_.end()) {
+ if ((db_type == "mysql") || (db_type == "postgresql")) {
+ std::string with = (db_type == "postgresql" ? "pgsql" : db_type);
+ isc_throw(db::InvalidType, "The Kea server has not been compiled with "
+ "support for configuration database type: " << db_type
+ << ". Did you forget to use --with-"
+ << with << " during compilation or to load libdhcp_"
+ << with << " hook library?");
+ }
isc_throw(db::InvalidType, "The type of the configuration backend: '" <<
db_type << "' is not supported");
}
- The MySQL lease manager uses the freely available MySQL as its backend
database. This is not included in Kea DHCP by default:
- the \--with-mysql switch must be supplied to "configure" for support
- to be compiled into the software.
+ the \--with-mysql switch must be supplied to "configure" for support to be
+ compiled into the software. This will also compile the "libdhcp_mysql.so" hook
+ library which must be loaded by adding it to the "hooks-libraries"
+ configuration parameter.
- The PostgreSQL lease manager uses the freely available PostgreSQL as its
backend database. This is not included in Kea DHCP by default:
- the \--with-pgsql switch must be supplied to "configure" for
- support to be compiled into the software.
+ the \--with-pgsql switch must be supplied to "configure" for support to be
+ compiled into the software. This will also compile the "libdhcp_pgsql.so" hook
+ library which must be loaded by adding it to the "hooks-libraries"
+ configuration parameter.
@section dhcpdb-instantiation Instantiation of Lease Managers
if (index == map_.end()) {
if ((db_type == "mysql") || (db_type == "postgresql")) {
string with = (db_type == "postgresql" ? "pgsql" : db_type);
- isc_throw(InvalidType, "The type of host backend: '" << db_type
- << "' is not compiled in. Did you forget to use --with-"
+ isc_throw(InvalidType, "The Kea server has not been compiled with "
+ "support for host database type: " << db_type
+ << ". Did you forget to use --with-"
<< with << " during compilation or to load libdhcp_"
- << with << "_hb hook library?");
+ << with << " hook library?");
}
isc_throw(InvalidType, "The type of host backend: '" <<
db_type << "' is not supported");
LOG_ERROR(dhcpsrv_logger, DHCPSRV_UNKNOWN_DB).arg(db_type);
string with = (db_type == "postgresql" ? "pgsql" : db_type);
isc_throw(InvalidType, "The Kea server has not been compiled with "
- "support for database type: " << db_type
+ "support for lease database type: " << db_type
<< ". Did you forget to use --with-"
<< with << " during compilation or to load libdhcp_"
- << with << "_lb hook library?");
+ << with << " hook library?");
}
// Get here on no match
LOG_ERROR(dhcpsrv_logger, DHCPSRV_UNKNOWN_DB).arg(parameters[type]);
@subsection postgreSQLHostMgr PostgreSQL Host Reservation Management
Storing and retrieving host reservations within a PostgreSQL schema is
-provided by the class, \ref isc::dhcp::PgSqlHostDataSource, a derivation of
+provided by the class, isc::dhcp::PgSqlHostDataSource, a derivation of
\ref isc::dhcp::BaseHostDataSource and is depicted in the following
class diagram:
" \"disabled-by-remote-command\": [],",
" \"disabled-by-user\": false,",
" \"globally-disabled\": false",
- " }",
+ " },",
" \"extended-info-tables\": <whether relay information is held in lease tables>,",
" \"high-availability\": [",
" {",
" \"in-touch\": <indicates if this server communicated with partner>,",
" \"last-scopes\": <list of scopes served by partner>,",
" \"last-state\": <HA state name of the partner>,",
- " \"role\": <partner role>",
+ " \"role\": <partner role>,",
" \"server-name\": <name of the partner server>,",
" \"system-time\": <system time in format '%Y-%m-%d %H:%M:%S' on UTC timezone>,",
" \"unacked-clients\": <number of unacked clients>,",
" \"sockets\": {",
" \"errors\": <list of errors received during the last attempt to open all sockets; only appears when status is failed or retrying>,",
" \"status\": <ready, retrying, or failed>",
- " }",
+ " },",
" \"thread-pool-size\": 4,",
- " \"uptime\": <uptime in seconds>,",
+ " \"uptime\": <uptime in seconds>",
" }",
"}"
],