database_backends.dox 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this
  5. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. /**
  7. @page dhcpDatabaseBackends DHCP Database Back-Ends
  8. All DHCP lease data is stored in some form of database, the interface
  9. to this being through the Lease Manager.
  10. All backend classes such as isc::dhcp::MySqlLeaseMgr are derived from
  11. the abstract isc::dhcp::LeaseMgr class. This provides methods to
  12. create, retrieve, modify and delete leases in the database.
  13. There are currently three available Lease Managers, Memfile, MySQL and
  14. PostgreSQL:
  15. - Memfile is an in-memory lease database which can be configured to persist
  16. its content to disk in a flat-file. Support for the Memfile database
  17. backend is built into Kea DHCP.
  18. - The MySQL lease manager uses the freely available MySQL as its backend
  19. database. This is not included in Kea DHCP by default:
  20. the \--with-dhcp-mysql switch must be supplied to "configure" for support
  21. to be compiled into the software.
  22. - The PostgreSQL lease manager uses the freely available PostgreSQL as its
  23. backend database. This is not included in Kea DHCP by default:
  24. the \--with-dhcp-pgsql switch must be supplied to "configure" for
  25. support to be compiled into the software.
  26. @section dhcpdb-instantiation Instantiation of Lease Managers
  27. A lease manager is instantiated through the @c LeaseMgrFactory class. This
  28. has three methods:
  29. - isc::dhcp::LeaseMgrFactory::create - Creates a singleton Lease
  30. Manager of the appropriate type.
  31. - isc::dhcp::LeaseMgrFactory::instance - Returns a reference to the
  32. the instance of the Lease Manager.
  33. - isc::dhcp::LeaseMgrFactory::destroy - Destroys the singleton lease manager.
  34. The selection of the Lease Manager (and thus the backend database) is
  35. controlled by the connection string passed to
  36. isc::dhcp::LeaseMgrFactory::create. This is a set of "keyword=value" pairs
  37. (no embedded spaces), each pair separated by a space from the others, e.g.
  38. \code
  39. type=mysql user=keatest password=keatest name=keatest host=localhost
  40. \endcode
  41. The following keywords are used for all backends:
  42. - <b>type</b> - specifies the type of database backend. The following values
  43. for the type keyword are supported:
  44. - <B>memfile</b> - In-memory database.
  45. - <b>mysql</b> - Use MySQL as the database. Must be enabled at compilation
  46. time.
  47. - <b>postgresql</b> - Use PostgreSQL as the database. Must be enabled
  48. at compilation time.
  49. - <b>cql</b> - Use Cassandra (CQL) as the database. Must be enabled at
  50. compilation time.
  51. The following sections list the database-specific keywords:
  52. @subsection dhcpdb-keywords-mysql MySQL connection string keywords
  53. - <b>host</b> - host on which the selected database is running. If not
  54. supplied, "localhost" is assumed.
  55. - <b>name</b> - name of the MySQL database to access. There is no default -
  56. this must always be supplied.
  57. - <b>password</b> - password for the selected user ID (see below). If not
  58. specified, no password is used.
  59. - <b>user</b> - database user ID under which the database is accessed. If not
  60. specified, no user ID is used - the database is assumed to be open.
  61. For details, see @ref isc::dhcp::MySqlConnection::openDatabase().
  62. @subsection dhcpdb-keywords-pgsql PostgreSQL connection string keywords
  63. - <b>host</b> - host on which the selected database is running. If not
  64. supplied, "localhost" is assumed.
  65. - <b>name</b> - name of the PostgreSQL database to access. There is no
  66. default - this must always be supplied.
  67. - <b>password</b> - password for the selected user ID (see below). If not
  68. specified, no password is used.
  69. - <b>user</b> - database user ID under which the database is accessed. If not
  70. specified, no user ID is used - the database is assumed to be open.
  71. For details, see @ref isc::dhcp::PgSqlConnection::openDatabase().
  72. @subsection dhcpdb-keywords-cql Cassandra (CQL) connection string keywords
  73. - <b>contact_points</b> - a list of comma separated IP addresses of the
  74. cluster contact points>
  75. - <b>port</b> - an integer specifying a connection port. If not specified, the
  76. default port will be used.
  77. - <b>user</b> - a database user name under which the database is accessed. If
  78. not specified, no user name is used - the database is assumed to be open.
  79. - <b>password</b> - an optional password if required for connection
  80. - <b>keyspace</b> - an optional keyspace. If not specified, the default value
  81. of 'keatest' will be used.
  82. For details, see @ref isc::dhcp::CqlConnection::openDatabase().
  83. */