First-Time Creation of the MySQL Database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Before preparing any Kea specific database and tables, the MySQL database
+must be configured to use the system timezone. Is is recommended to use UTC
+timezone for both the system and the MySQL database.
+
+To check the system timezone:
+
+ .. code-block:: console
+
+ date +%Z
+
+To check the MySQL timezone:
+
+ .. code-block:: mysql
+
+ mysql> SELECT @@system_time_zone;
+ mysql> SELECT @@global.time_zone;
+ mysql> SELECT @@session.time_zone;
+
+To configure the MySQL timezone for your server, please reffer to the
+installed version documentation.
+
+Usually the setting is configured in the [mysqld] section in /etc/mysql/my.cnf,
+/etc/mysql/mysql.cnf, /etc/mysql/mysqld.cnf or
+/etc/mysql/mysql.conf.d/mysqld.cnf
+
+ .. code-block:: ini
+
+ [mysqld]
+ # using default-time-zone
+ default-time-zone='+00:00'
+
+ # or using timezone
+ timezone='UTC'
+
When setting up the MySQL database for the first time, the
database area must be created within MySQL, and the MySQL user ID under
which Kea will access the database must be set up. This needs to be done manually,
First-Time Creation of the PostgreSQL Database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Before preparing any Kea specific database and tables, the PostgreSQL database
+must be configured to use the system timezone. Is is recommended to use UTC
+timezone for both the system and the PostgreSQL database.
+
+To check the system timezone:
+
+ .. code-block:: console
+
+ date +%Z
+
+To check the PostgreSQL timezone:
+
+ .. code-block:: psql
+
+ postgres=# show timezone;
+ postgres=# SELECT * FROM pg_timezone_names WHERE name = current_setting('TIMEZONE');
+
+To configure the PostgreSQL timezone for your server, please reffer to the
+installed version documentation.
+
+Usually the setting is configured in the postgresql.conf with the varying
+version path /etc/postgresql/<version>/main/postgresql.conf.
+
+ .. code-block:: ini
+
+ timezone = 'UTC'
+
The first task is to create both the database and the user under
which the servers will access it. A number of steps are required:
the appropriate entries added to PostgreSQL's pg_hba.conf file. This
file is normally located in the primary data directory for the
PostgreSQL server. The precise path may vary depending on the
- operating system and version, but the default location for PostgreSQL
- 9.3 on Centos 6.5 is: ``/var/lib/pgsql/9.3/data/pg_hba.conf``.
+ operating system and version, but the default location for PostgreSQL is
+ ``/etc/postgresql/*/main/postgresql.conf``.
Assuming Kea is running on the same host as PostgreSQL, adding lines
similar to the following should be sufficient to provide
The servers store their information independently, so each server can
use a separate database or both servers can use the same database.
+.. note::
+
+ Kea requires the database timezone to match the system timezone.
+ For more details, see :ref:`mysql-database-create` and
+ :ref:`pgsql-database-create`.
+
Lease database configuration is controlled through the
Dhcp4/lease-database parameters. The database type must be set to
"memfile", "mysql", "postgresql", or "cql", e.g.:
separately, but can also point to the same database. Currently the
supported hosts database types are MySQL, PostgreSQL, and Cassandra.
+For example, the following configuration can be used to configure a
+connection to MySQL:
+
+::
+
+ "Dhcp4": {
+ "hosts-database": {
+ "type": "mysql",
+ "name": "kea",
+ "user": "kea",
+ "password": "secret123",
+ "host": "localhost",
+ "port": 3306
+ }
+ }
+
Please note that usage of hosts storage is optional. A user can define
all host reservations in the configuration file, and that is the
recommended way if the number of reservations is small. However, when
configured after a (required) read-write store, or the addition will
fail.
+.. note::
+
+ Kea requires the database timezone to match the system timezone.
+ For more details, see :ref:`mysql-database-create` and
+ :ref:`pgsql-database-create`.
+
.. _hosts-databases-configuration4:
DHCPv4 Hosts Database Configuration
The servers store their information independently, so each server can
use a separate database or both servers can use the same database.
+.. note::
+
+ Kea requires the database timezone to match the system timezone.
+ For more details, see :ref:`mysql-database-create` and
+ :ref:`pgsql-database-create`.
+
Lease database configuration is controlled through the
Dhcp6/lease-database parameters. The database type must be set to
"memfile", "mysql", "postgresql", or "cql", e.g.:
configured after a (required) read-write store, or the addition will
fail.
+.. note::
+
+ Kea requires the database timezone to match the system timezone.
+ For more details, see :ref:`mysql-database-create` and
+ :ref:`pgsql-database-create`.
+
.. _hosts-databases-configuration6:
DHCPv6 Hosts Database Configuration