Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kea config tool and server configuration in database backend #81

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

razvan-becheriu
Copy link
Contributor

No description provided.

@vrisk
Copy link
Collaborator

vrisk commented Jun 4, 2018

Hi Razavan,

What does this do? Can you give a 2 sentence description? Thank you!

Vicky

@razvan-becheriu
Copy link
Contributor Author

razvan-becheriu commented Jun 5, 2018

Hi,
This pull request contains the Deutsche Telekom AG implementation of the server configuration storage in the database and the configuration tool used to configure the servers.
This adds the server functionality to synchronize several servers configurations using a database backend. It was developed for Mysql, Pgsql and Cassandra.
The servers are able to detect configuration changes and automatically reload the configuration.

I will add more details and documentation to this PR as soon as possible.

@razvan-becheriu razvan-becheriu changed the title Kea config tool Kea config tool and server configuration in database backend Jun 8, 2018
@vrisk
Copy link
Collaborator

vrisk commented Jun 12, 2018

Thanks for the description - what I am interested in is some discussion about the design you are working towards.
Is the configuration pulled, or pushed to the Kea servers? You say the servers detect the change and pull the change, is that right? Kind of like the way DNS updates??
Where is the master config file? Is the ultimate source of truth in Cassandra or in Kea?
Can the admin make changes in Kea as well - and how are conflicts handled?
This is a big architectural decision for Kea, and I just want to understand where you are headed.

@razvan-becheriu
Copy link
Contributor Author

razvan-becheriu commented Jun 18, 2018

                     Kea DHCP Config Tool Reference Manual

   --------------------------------------------------------------------------

   Kea Configuration Tool is an application used to upload/download Kea server
   configuration to/from the database backend.

   The supported database backends are: Cassandra, PostgreSql and MySQL.

   The tool can be used to manage both kea-dhcp6 and kea-dhcp4 server
   configurations.

   The executable file's name is kea-config-tool.

   Currently supported operations (printed by using --help option):
   --------------------------------------------------------------------------
eg:
    /path/to/kea/install/sbin/kea-config-tool -h
 - -h or --help: Displays this help.
 - db-create: Creates new empty databases. Useful for first time installation.
 - db-remove: Removes an existing database.
 - create-db-and-users: internal use only
 - lease-init: Initializes new lease database. Useful for first time installation.
 - lease-drop: Drops all tables in the lease database. 
 - lease-version: Checks version of the existing lease database scheme. Useful
 -                for checking lease DB version when preparing for an upgrade.
 - lease-upgrade: Upgrades your lease database scheme
 - lease-dump: Dump current leases to a CSV file
 - config-init: Initalizes new config database. Useful for first time installation.
 - config-version: Checks version of the existing config database scheme. Useful
 -                 for checking config DB version when preparing for an upgrade.
 - config-upgrade: Upgrades your config database scheme
 - master-init: Initalizes new master config database. Useful for first time installation.
 - master-version: Checks version of the existing master config database scheme. Useful
 -                 for checking master config DB version when preparing for an upgrade.
 - master-upgrade: Upgrades your master config database scheme

BACKEND - one of the supported backends: memfile|mysql|pgsql|cql

PARAMETERS: Parameters are optional in general, but may be required
            for specific operation.
 -s or --server - specifies remote database server address
 -sp or --server-port - specifies remote database server port
 --db-server-version - specifies remote database version
 -h or --host hostname - specifies a hostname of a database to connect to
 -u or --user name - specifies username when connecting to a database
 -p or --password pass - specifies a password when connecting to a database
 -n or --name database - specifies a database name to connect to
 -d or --directory - path to upgrade scripts (default: /opt/dt-kea-config-tool/share/dt-kea/scripts)

 Parameters specific to lease-dump:
     -4 to dump IPv4 leases to file
     -6 to dump IPv6 leases to file
     -o or --output - name of file to which leases will be dumped
   --------------------------------------------------------------------------

   The kea config tool can be used to configure multiple servers at once by
   updating the configuration in the 'shard' database.

   Currently supported operations (printed by using --help option):
   --------------------------------------------------------------------------
eg:
    /path/to/kea/install/sbin/kea-config-tool -shard -h
  NAME 
	 -shard: Configures a shard database

  SYNOPSIS 
	 -shard -set-config -4|-6 master-config-file input-shards-directory-path [list-of-shards]
	 -shard -get-config -4|-6 master-config-file output-shards-directory-path list-of-shards

  DESCRIPTION
	 -set-config writes the provided server configuration into shards.
	 -get-config retrieves server configuration from shards and writes it locally.

  OPTIONS
	 -4|-6 - specifies DHCPV6 or DHCPV4 operation.
	 master-config-file - configuration file which provides the master database backend credentials.
	 input-shards-directory-path - The path from the shards configuration is loaded.
	 output-shards-directory-path - The path where the shards configuration will be stored.
	 list-of-shards - the shards names (comma separated) for which the command is applied
			 (for the case when list-of-shards is optional and no value 
			 is provided then the command is applied for all found shards).
   --------------------------------------------------------------------------

   This implies that a database is created to store the 'shard' backend configuration.
   --------------------------------------------------------------------------
eg:
   /path/to/kea/install/sbin/kea-config-tool -dbinit config-init cql --name kea_shard
or
   /path/to/kea/install/sbin/kea-config-tool -dbinit config-init mysql --name kea_shard
or
   /path/to/kea/install/sbin/kea-config-tool -dbinit config-init pgsql --name kea_shard
   --------------------------------------------------------------------------

   The content of the shard database consists in 3 tables:
      - config_schema_version - stores the configuration schema version (just
        like schema_version does for lease database) in the columns:
            version, minor
      - server_configuration4 - stores the 'shard' server v4 configuration
      - server_configuration6 - stores the 'shard' server v6 configuration
   Both server_configuration4 and server_configuration6 store the data in the
   columns:
            config_id - a unique identifier of the configuration (primary key)
                      - as a design recommendation, this column can be a simple
                        uuid (current implementation) or md5sum or version id
            generic_data - a generic configuration or data associated with the
                           uploaded configuration (can be used to store the
                           source of the configuration in yaml format used by
                           external tools to generate the final configuration)
            json_data - the kea server configuration (the content of the kea
                        server configuration file)
            timestamp - an unique timestamp which is used to check that the new
                        configuration updates the latest configuration and no
                        other updates have been done between last download and
                        upload configuration commands

   The command to download the 'shard' configuration from the database backend:
   --------------------------------------------------------------------------
eg:
   /path/to/kea/install/sbin/kea-config-tool -shard -get-config -4 shard-db-connect.4.ini ./work/4/ kea_shard
or
   /path/to/kea/install/sbin/kea-config-tool -shard -get-config -6 shard-db-connect.6.ini ./work/6/ kea_shard
   --------------------------------------------------------------------------

   The command to upload the 'shard' configuration to the database backend:
   --------------------------------------------------------------------------
eg:
   /path/to/kea/install/sbin/kea-config-tool -shard -set-config -4 shard-db-connect.4.ini ./initial-config/4/
or
   /path/to/kea/install/sbin/kea-config-tool -shard -set-config -6 shard-db-connect.6.ini ./initial-config/6/
   --------------------------------------------------------------------------

   The files shard-db-connect.4.ini and shard-db-connect.6.ini contain
   connection information needed by the tool to access the database backend.
   --------------------------------------------------------------------------
eg:
shard-db-connect.4.ini content:
{
  "Dhcp4": {
    "config-database": {
      "user": "keatest",
      "type": "cql",
      "password": "keatest",
      "keyspace": "kea_shard",
      "contact-points": "127.0.0.1"
    },
    "configuration-type": "database"
  }
}

shard-db-connect.6.ini content:
{
  "Dhcp6": {
    "config-database": {
      "user": "keatest",
      "type": "cql",
      "password": "keatest",
      "keyspace": "kea_shard",
      "contact-points": "127.0.0.1"
    },
    "configuration-type": "database"
  }
}
   --------------------------------------------------------------------------
   The 'config-database' parameter contains the connection options for the
   database backend (just like 'lease-database' does).
   The 'configuration-type' parameter specifies if the configuration is stored
   in a database backend ('database' value) or in a file ('file' value), just
   like the common configuration of the kea server.
   The 'file' value is set by default (when 'configuration-type' is missing).

   The 'initial-config/4/' or 'initial-config/6/' folder must provide a list of
   'shard' configurations, each with it's own folder (the name of the folder must
   match the database name used in the credentials file) with the following
   configuration files:
   - config.generic - the generic configuration to be uploaded in the database
   - config.json - the kea server configuration to be uploaded in the database

   The server must be configured to access the configuration database backend
   with it's own credentials, by providing just the details found in the
   shard-db-connect.4.ini or shard-db-connect.6.ini files, instead of a
   complete kea server configuration.

   The servers will autodetect the configuration change when handling any DHCP
   packet and reload the new configuration (dropping the current packet).

   The kea config tool can be used to configure multiple shards at once by
   updating the configuration in the 'master' database.

   Currently supported operations (printed by using --help option):
   --------------------------------------------------------------------------
eg:
    /path/to/kea/install/sbin/kea-config-tool -master -h
  NAME 
	 -master - Configures a master database

  SYNOPSIS 
	 -master -set-servers -4|-6 master-config-file input-shards-directory-path [list-of-shards]
	 -master -get-servers -4|-6 master-config-file output-shards-directory-path

  DESCRIPTION
	 -set-servers write the provided servers configuration into master database.
	 -get-servers retrieves servers configuration from the master database and writes them locally.

  OPTIONS
	 -4|-6 - specifies DHCPV6 or DHCPV4 operation.
	 master-config-file - configuration file which provides the master database backend credentials.
	 input-shards-directory-path - The path from the master configuration is loaded.
	 output-shards-directory-path - The path where the master configuration will be stored.
	 list-of-shards - the shards names (comma separated) for which the command is applied
			 (for the case when list-of-shards is optional and not specified
			 is provided then the command is applied for all found shards).
   --------------------------------------------------------------------------

   This implies that a database is created to store the 'master' backend configuration.
   --------------------------------------------------------------------------
eg:
   /path/to/kea/install/sbin/kea-config-tool -dbinit master-init cql --name kea_master
or
   /path/to/kea/install/sbin/kea-config-tool -dbinit master-init mysql --name kea_master
or
   /path/to/kea/install/sbin/kea-config-tool -dbinit master-init pgsql --name kea_master
   --------------------------------------------------------------------------

   The content of the master database consists in 3 tables:
      - master_schema_version - stores the configuration schema version (just
        like schema_version does for lease database) in the columns:
            version, minor
      - server_configuration4 - stores the v4 mapping between the 'shard'
                                database and each server instance
      - server_configuration6 - stores the v6 mapping between the 'shard'
                                database and each server instance
   Both server_configuration4 and server_configuration6 store the data in the
   columns:
            instance_id - a unique identifier of the server instance or kea
                          config tool instance (primary key)
            config_database - the credentials used by the specific instance to
                              connect to the 'shard' database backend
            config_database_name - the name of the 'shard' or database name
                                   used by the kea config tool to retrieve the
                                   mapping of a specific 'shard'
            server_config - the specific options of the server instance (the
                            'interfaces-config' and 'Logging' options which may
                            be different for each server)
            timestamp - an unique timestamp which is used to check that the new
                        configuration updates the latest configuration and no
                        other updates have been done between last download and
                        upload configuration commands

   The command to download the 'master' configuration from the database backend:
   --------------------------------------------------------------------------
eg:
   /path/to/kea/install/sbin/kea-config-tool -master -get-servers -4 master-db-connect.4.ini ./work/4/
or
   /path/to/kea/install/sbin/kea-config-tool -master -get-servers -6 master-db-connect.6.ini ./work/6/
   --------------------------------------------------------------------------

   The command to upload the 'master' configuration to the database backend:
   --------------------------------------------------------------------------
eg:
   /path/to/kea/install/sbin/kea-config-tool -master -set-servers -4 master-db-connect.4.ini ./initial-config/4/
or
   /path/to/kea/install/sbin/kea-config-tool -master -set-servers -6 master-db-connect.6.ini ./initial-config/6/
   --------------------------------------------------------------------------

   The files master-db-connect.4.ini and master-db-connect.6.ini contain
   connection information needed by the tool to access the database backend.
   --------------------------------------------------------------------------
eg:
master-db-connect.4.ini content:
{
  "Dhcp4": {
    "configuration-type": "database",
    "instance-id": "kea-config-tool",
    "master-database": {
      "contact-points": "127.0.0.1",
      "keyspace": "kea_master",
      "max-statement-tries": 1,
      "password": "",
      "type": "cql",
      "user": ""
    }
  }
}
master-db-connect.6.ini content:
{
  "Dhcp6": {
    "configuration-type": "database",
    "instance-id": "kea-config-tool",
    "master-database": {
      "contact-points": "127.0.0.1",
      "keyspace": "kea_master",
      "max-statement-tries": 1,
      "password": "",
      "type": "cql",
      "user": ""
    }
  }
}
   --------------------------------------------------------------------------
   The 'master-database' parameter contains the connection options for the
   database backend (just like 'lease-database' does).
   The 'configuration-type' parameter specifies if the configuration is stored
   in a database backend ('database' value) or in a file ('file' value), just
   like the common configuration of the kea server.
   The 'file' value is set by default (when 'configuration-type' is missing).
   The 'instance-id' is the unique identifier of the kea config tool used.
   There can be more kea config tool instances used to upload/download the
   master configuration, each with it's own credentials. The credentials of
   each kea config tool instance will be saved in the 'master' database, for
   each shard using the following format: 'kea-config-tool-id'@'shard-name'.

   The 'initial-config/4/' or 'initial-config/6/' folder must provide a list of
   'shard' configurations, each with it's own folder (the name of the folder must
   match the database name used in the credentials file) with the following
   configuration files:
   - credentials.json - the credentials used by the kea config tool to connect
                        to the 'shard' database if operations on the 'shard'
                        database are performed
   - servers.json - the list of servers to be mapped in the current 'shard'

   The content of the servers.json:
   --------------------------------------------------------------------------
eg:
{
  "config-database": {
    "user": "keatest",
    "type": "cql",
    "password": "keatest",
    "keyspace": "kea_shard",
    "contact-points": "192.168.128.17,192.168.128.18,192.168.128.19,192.168.128.20,192.168.128.21,192.168.128.22"
  },
  "master-config": [
    {
      "instance-id": "kea-dhcp4-server1",
      "server-config": {
        "Dhcp4": {
          "interfaces-config": {
            "interfaces": [
              "ens4"
            ]
          }
        },
        "Logging": {
          "loggers": [
            {
              "name": "kea-dhcp4",
              "output_options": [
                {
                  "output": "/var/log/kea-dhcp4.log"
                }
              ],
              "severity": "DEBUG",
              "debuglevel": 99
            }
          ]
        }
      }
    },
    {
      "instance-id": "kea-dhcp4-server2",
      "server-config": {
        "Dhcp4": {
          "interfaces-config": {
            "interfaces": [
              "ens4"
            ]
          }
        },
        "Logging": {
          "loggers": [
            {
              "name": "kea-dhcp4",
              "output_options": [
                {
                  "output": "/var/log/kea-dhcp4.log"
                }
              ],
              "severity": "DEBUG",
              "debuglevel": 99
            }
          ]
        }
      }
    }
  ]
}
or:
{
  "config-database": {
    "user": "keatest",
    "type": "cql",
    "password": "keatest",
    "keyspace": "kea_shard",
    "contact-points": "192.168.128.17,192.168.128.18,192.168.128.19,192.168.128.20,192.168.128.21,192.168.128.22"
  },
  "master-config": [
    {
      "instance-id": "kea-dhcp6-server1",
      "server-config": {
        "Dhcp6": {
          "interfaces-config": {
            "interfaces": [
              "ens4"
            ]
          }
        },
        "Logging": {
          "loggers": [
            {
              "name": "kea-dhcp6",
              "output_options": [
                {
                  "output": "/var/log/kea-dhcp6.log"
                }
              ],
              "severity": "DEBUG",
              "debuglevel": 99
            }
          ]
        }
      }
    },
    {
      "instance-id": "kea-dhcp6-server2",
      "server-config": {
        "Dhcp6": {
          "interfaces-config": {
            "interfaces": [
              "ens4"
            ]
          }
        },
        "Logging": {
          "loggers": [
            {
              "name": "kea-dhcp6",
              "output_options": [
                {
                  "output": "/var/log/kea-dhcp6.log"
                }
              ],
              "severity": "DEBUG",
              "debuglevel": 99
            }
          ]
        }
      }
    }
  ]
}
   --------------------------------------------------------------------------
   The 'config-database' option inside the servers.json contains the 'shard'
   backend credentials for all servers that are mapped to this 'shard'.
   The 'master-config' option contains a list of servers to be mapped to this
   'shard', each with it's own instance id and specific 'interfaces-config' and
   'Logging' settings.

   The server must be configured to access the master database backend with
   it's own credentials and instance id, by providing just the details
   found in the master-db-connect.4.ini or master-db-connect.6.ini files,
   instead of a complete kea server configuration.

   The servers will autodetect the configuration change when handling any DHCP
   packet and reload the new configuration (dropping the current packet).

   Examples of all the files needed can be found in the examples directory:
   - for initial config:
   doc/examples/kea_config_tool/initial-config-*
   - for master-db-connect.ini or shard-db-connect.ini:
   doc/examples/kea_config_tool/master-db-connect*
   - for kea server local config file:
   doc/examples/kea_config_tool/local/kea*

@razvan-becheriu
Copy link
Contributor Author

To answer some of your questions:

Is the configuration pulled, or pushed to the Kea servers?

The server is pushed in the database, and the servers pull the configuration whenever they detect that the in ram configuration is different from the one in the database.

You say the servers detect the change and pull the change, is that right? Kind of like the way DNS updates??

Yes, you are right. The servers pull the configuration.

Where is the master config file?

Each server has a connection details to connect to the master database, and from there it gets the 'shard' database configuration details using it's 'instance-id', plus the 'interfaces-config' and 'Logging' own configuration (which might be different for each server).

Is the ultimate source of truth in Cassandra or in Kea?

The ultimate truth is in the database (Cassandra, MySql or PostgreSql).

Can the admin make changes in Kea as well - and how are conflicts handled?

I am not sure what you mean. The kea server does not have any configuration stored locally. It receives the configuration from the database backend. If you are referring to the 'config-get' and 'config-set' commands on the command socket, these do not download/update the configuration in the database, only in the file (ISC implementation). We could think of completely removing the kea config tool if using these commands to download/upload the configuration directly in the database, but we must think of a way to distinguish between file and database backend, and the different configuration scenarios (shard/master).

@razvan-becheriu
Copy link
Contributor Author

1. configure all databases (mysql, postgresql, cassandra)
Tests were run on:
ubuntu 18.04
mysql server 5.7.22
postgresql server 10.4
cassandra server 3.11.2

### for postgresql, there is a special configuration that must be done before you proceed (you might be aware of it, but still listing it here)
- login into the user postgres
su postgres
- connect to postgres server using postgres user
psql
- change the password for postgres
\password postgres
- exit postgres and user and modify as root the pg_hba.conf
vi /etc/postgresql/10/main/pg_hba.conf
############################################################################
...
# Database administrative login by Unix domain socket
local   all             postgres                                password

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     password
# IPv4 local connections:
host    all             all             127.0.0.1/32            password
# IPv6 local connections:
host    all             all             ::1/128                 password
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     password
host    replication     all             127.0.0.1/32            password
host    replication     all             ::1/128                 password
...
############################################################################
- restart the postgres service
sudo systemctl restart postgresql.service

### for cassandra, there is a special configuration that must be done before you proceed (you might be aware of it, but still listing it here)
- connect to cassandra using cassandra user
cqlsh
- change the password for cassandra
ALTER ROLE cassandra WITH PASSWORD='password'
- modify the cassandra.yaml configuration file
vi /etc/cassandra/cassandra.yaml
############################################################################
...
authenticator: PasswordAuthenticator
...
authorizer: CassandraAuthorizer
...
############################################################################
- restart the cassandra service
sudo systemctl restart cassandra.service

2. with an empty database create keatest database, keatest and keatest_readonly users:
./kea-config-tool -dbinit create-db-and-users mysql --user root --password password
./kea-config-tool -dbinit create-db-and-users pgsql --user postgres --password password
./kea-config-tool -dbinit create-db-and-users cql --user cassandra --password password

3. create kea_master database:
./kea-config-tool -dbinit db-create mysql --user root --password password -n kea_master
./kea-config-tool -dbinit db-create pgsql --user postgres --password password -n kea_master
./kea-config-tool -dbinit db-create cql --user cassandra --password password -n kea_master

4. create kea_shard database:
./kea-config-tool -dbinit db-create mysql --user root --password password -n kea_shard
./kea-config-tool -dbinit db-create pgsql --user postgres --password password -n kea_shard
./kea-config-tool -dbinit db-create cql --user cassandra --password password -n kea_shard

5. initialize kea_master database config tables:
./kea-config-tool -dbinit master-init mysql --user root --password password -n kea_master
./kea-config-tool -dbinit master-init pgsql --user postgres --password password -n kea_master
./kea-config-tool -dbinit master-init cql --user cassandra --password password -n kea_master

6. initialize kea_shard database lease tables
./kea-config-tool -dbinit lease-init mysql --user root --password password -n kea_shard
./kea-config-tool -dbinit lease-init pgsql --user postgres --password password -n kea_shard
./kea-config-tool -dbinit lease-init cql --user cassandra --password password -n kea_shard

7. initialize kea_shard database config tables:
./kea-config-tool -dbinit config-init mysql --user root --password password -n kea_shard
./kea-config-tool -dbinit config-init pgsql --user postgres --password password -n kea_shard
./kea-config-tool -dbinit config-init cql --user cassandra --password password -n kea_shard

8. upload the 'server instance - config database' mapping in the master database:
 - the kea-config-tool credentials for the kea_master database are found in the master-db-connect-*.ini file
 - the kea server credentials for the kea_shard database are found in the servers.json file
/path/to/kea/install/sbin/kea-config-tool -master -set-servers -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-mysql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-mysql/kea4/
/path/to/kea/install/sbin/kea-config-tool -master -set-servers -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-mysql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-mysql/kea6/
/path/to/kea/install/sbin/kea-config-tool -master -set-servers -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-pgsql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-pgsql/kea4/
/path/to/kea/install/sbin/kea-config-tool -master -set-servers -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-pgsql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-pgsql/kea6/
/path/to/kea/install/sbin/kea-config-tool -master -set-servers -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-cql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-cql/kea4/
/path/to/kea/install/sbin/kea-config-tool -master -set-servers -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-cql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-cql/kea6/

9. upload the servers configuration in the config database:
 - the kea-config-tool credentials for the kea_master database are found in the master-db-connect-*.ini file
 - the kea-config-tool credentials for the kea_shard are found in the credentials.json file
 - the kea servers configuration in found in the config.json file
/path/to/kea/install/sbin/kea-config-tool -shard -set-config -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-mysql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-mysql/kea4/
/path/to/kea/install/sbin/kea-config-tool -shard -set-config -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-mysql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-mysql/kea6/
/path/to/kea/install/sbin/kea-config-tool -shard -set-config -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-pgsql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-pgsql/kea4/
/path/to/kea/install/sbin/kea-config-tool -shard -set-config -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-pgsql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-pgsql/kea6/
/path/to/kea/install/sbin/kea-config-tool -shard -set-config -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-cql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-cql/kea4/
/path/to/kea/install/sbin/kea-config-tool -shard -set-config -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-cql.ini /path/to/kea/install/share/doc/kea/examples/kea-config-tool/initial-config-cql/kea6/

10. download the 'server instance - config database' mapping from the master database:
/path/to/kea/install/sbin/kea-config-tool -master -get-servers -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-mysql.ini ./mysql4/
/path/to/kea/install/sbin/kea-config-tool -master -get-servers -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-mysql.ini ./mysql6/
/path/to/kea/install/sbin/kea-config-tool -master -get-servers -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-pgsql.ini ./pgsql4/
/path/to/kea/install/sbin/kea-config-tool -master -get-servers -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-pgsql.ini ./pgsql6/
/path/to/kea/install/sbin/kea-config-tool -master -get-servers -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-cql.ini ./cql4/
/path/to/kea/install/sbin/kea-config-tool -master -get-servers -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-cql.ini ./cql6/

11. download the servers configuration from the config database:
/path/to/kea/install/sbin/kea-config-tool -shard -get-config -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-mysql.ini ./mysql4/ kea_shard
/path/to/kea/install/sbin/kea-config-tool -shard -get-config -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-mysql.ini ./mysql6/ kea_shard
/path/to/kea/install/sbin/kea-config-tool -shard -get-config -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-pgsql.ini ./pgsql4/ kea_shard
/path/to/kea/install/sbin/kea-config-tool -shard -get-config -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-pgsql.ini ./pgsql6/ kea_shard
/path/to/kea/install/sbin/kea-config-tool -shard -get-config -4 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-cql.ini ./cql4/ kea_shard
/path/to/kea/install/sbin/kea-config-tool -shard -get-config -6 /path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-cql.ini ./cql6/ kea_shard

12. start the servers:
 - the kea server credentials for the_master database are found in the kea*-master-*.conf
/path/to/kea/install/sbin/kea-dhcp4 -c /path/to/kea/install/share/doc/kea/examples/kea-config-tool/local/kea4/kea4-master-mysql.conf
/path/to/kea/install/sbin/kea-dhcp6 -c /path/to/kea/install/share/doc/kea/examples/kea-config-tool/local/kea6/kea6-master-mysql.conf
/path/to/kea/install/sbin/kea-dhcp4 -c /path/to/kea/install/share/doc/kea/examples/kea-config-tool/local/kea4/kea4-master-pgsql.conf
/path/to/kea/install/sbin/kea-dhcp6 -c /path/to/kea/install/share/doc/kea/examples/kea-config-tool/local/kea6/kea6-master-pgsql.conf
/path/to/kea/install/sbin/kea-dhcp4 -c /path/to/kea/install/share/doc/kea/examples/kea-config-tool/local/kea4/kea4-master-cql.conf
/path/to/kea/install/sbin/kea-dhcp6 -c /path/to/kea/install/share/doc/kea/examples/kea-config-tool/local/kea6/kea6-master-cql.conf

The kea config tool can upload the server configuration without the use of the master database and can connect directly to the config database by using:
/path/to/kea/install/share/doc/kea/examples/kea-config-tool/shard-db-connect-*.ini
instead of:
/path/to/kea/install/share/doc/kea/examples/kea-config-tool/master-db-connect-*.ini

The kea servers can connect directly to the config database by using:
/path/to/kea/install/share/doc/kea/examples/kea-config-tool/local/kea*/kea*-shard-*.conf
instead of:
/path/to/kea/install/share/doc/kea/examples/kea-config-tool/local/kea*/kea*-master-*.conf

@razvan-becheriu
Copy link
Contributor Author

For a smaller diff, please review and merge the PR#66 (#66) first.

To separate between the kea config tool and the server implementation, you can review only the server implementation by ignoring the ./src/bin/kea_config_tool/ and ./doc/ folders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants