database_backends.dox 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Copyright (C) 2012-2015 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. Nothing is written to any
  45. external storage, so this should not be used in production.
  46. - <b>mysql</b> - Use MySQL as the database
  47. The following sections list the database-specific keywords:
  48. @subsection dhcpdb-keywords-mysql MySQL connection string keywords
  49. - <b>host</b> - host on which the selected database is running. If not
  50. supplied, "localhost" is assumed.
  51. - <b>name</b> - name of the MySQL database to access. There is no default -
  52. this must always be supplied.
  53. - <b>password</b> - password for the selected user ID (see below). If not
  54. specified, no password is used.
  55. - <b>user</b> - database user ID under which the database is accessed. If not
  56. specified, no user ID is used - the database is assumed to be open.
  57. @subsection dhcpdb-keywords-pgsql PostgreSQL connection string keywords
  58. - <b>host</b> - host on which the selected database is running. If not
  59. supplied, "localhost" is assumed.
  60. - <b>name</b> - name of the PostgreSQL database to access. There is no
  61. default - this must always be supplied.
  62. - <b>password</b> - password for the selected user ID (see below). If not
  63. specified, no password is used.
  64. - <b>user</b> - database user ID under which the database is accessed. If not
  65. specified, no user ID is used - the database is assumed to be open.
  66. */