![]() |
Kea
1.5.0
|
Storage for High Availability configuration. More...
#include <ha_config.h>
Classes | |
| class | PeerConfig |
| HA peer configuration. More... | |
| class | StateConfig |
| Configuration specific to a single HA state. More... | |
| class | StateMachineConfig |
| State machine configuration information. More... | |
Public Types | |
| enum | HAMode { LOAD_BALANCING, HOT_STANDBY } |
| Mode of operation. More... | |
| typedef std::map< std::string, PeerConfigPtr > | PeerConfigMap |
| Map of the servers' configurations. More... | |
| typedef boost::shared_ptr< PeerConfig > | PeerConfigPtr |
| Pointer to the server's configuration. More... | |
| typedef boost::shared_ptr< StateConfig > | StateConfigPtr |
| Pointer to the state configuration. More... | |
| typedef boost::shared_ptr< StateMachineConfig > | StateMachineConfigPtr |
| Pointer to a state machine configuration. More... | |
Public Member Functions | |
| HAConfig () | |
| Constructor. More... | |
| bool | amSendingLeaseUpdates () const |
| Returns boolean flag indicating whether lease updates should be sent to the partner. More... | |
| bool | amSyncingLeases () const |
| Returns boolean flag indicating whether the active servers should synchronize their lease databases upon startup. More... | |
| PeerConfigMap | getAllServersConfig () const |
| Returns configurations of all servers. More... | |
| PeerConfigPtr | getFailoverPeerConfig () const |
| Returns configuration of the partner which takes part in failover. More... | |
| HAMode | getHAMode () const |
| Returns mode of operation. More... | |
| uint32_t | getHeartbeatDelay () const |
| Returns heartbeat delay in milliseconds. More... | |
| uint32_t | getMaxAckDelay () const |
| Returns maximum time for a client trying to communicate with DHCP server to complete the transaction. More... | |
| uint32_t | getMaxResponseDelay () const |
| Returns max response delay. More... | |
| uint32_t | getMaxUnackedClients () const |
| Returns maximum number of clients which may fail to communicate with the DHCP server before entering partner down state. More... | |
| PeerConfigMap | getOtherServersConfig () const |
| Returns configuration of other servers. More... | |
| PeerConfigPtr | getPeerConfig (const std::string &name) const |
| Returns configuration of the specified server. More... | |
| StateMachineConfigPtr | getStateMachineConfig () const |
| Returns state machine configuration. More... | |
| uint32_t | getSyncPageLimit () const |
| Returns maximum number of leases per page to be fetched during database synchronization. More... | |
| uint32_t | getSyncTimeout () const |
| Returns timeout for lease database synchronization. More... | |
| PeerConfigPtr | getThisServerConfig () const |
| Returns configuration of this server. More... | |
| std::string | getThisServerName () const |
| Returns name of this server. More... | |
| PeerConfigPtr | selectNextPeerConfig (const std::string &name) |
| Creates and returns pointer to the new peer's configuration. More... | |
| void | setHAMode (const std::string &ha_mode) |
| Sets new mode of operation. More... | |
| void | setHeartbeatDelay (const uint32_t heartbeat_delay) |
| Sets new heartbeat delay in milliseconds. More... | |
| void | setMaxAckDelay (const uint32_t max_ack_delay) |
| Sets maximum time for a client trying to communicate with DHCP server to completed the transaction. More... | |
| void | setMaxResponseDelay (const uint32_t max_response_delay) |
| Sets new max response delay. More... | |
| void | setMaxUnackedClients (const uint32_t max_unacked_clients) |
| Set maximum number of clients which may fail to communicate with the DHCP server before entering partner down state. More... | |
| void | setSendLeaseUpdates (const bool send_lease_updates) |
| Sets boolean flag indicating whether lease updates should be sent to the partner. More... | |
| void | setSyncLeases (const bool sync_leases) |
| Sets boolean flag indicating whether the active servers should synchronize their lease databases upon startup. More... | |
| void | setSyncPageLimit (const uint32_t sync_page_limit) |
| Sets new page limit size for leases fetched from the partner during database synchronization. More... | |
| void | setSyncTimeout (const uint32_t sync_timeout) |
| Sets new lease database syncing timeout in milliseconds. More... | |
| void | setThisServerName (const std::string &this_server_name) |
| Sets name of this server. More... | |
| void | validate () const |
| Validates configuration. More... | |
Static Public Member Functions | |
| static std::string | HAModeToString (const HAMode &ha_mode) |
| Returns HA mode name. More... | |
| static HAMode | stringToHAMode (const std::string &ha_mode) |
| Decodes HA mode provided as string. More... | |
Public Attributes | |
| HAMode | ha_mode_ |
| Mode of operation. More... | |
| uint32_t | heartbeat_delay_ |
| Heartbeat delay in milliseconds. More... | |
| uint32_t | max_ack_delay_ |
| Maximum DHCP message ack delay. More... | |
| uint32_t | max_response_delay_ |
| Max delay in response to heartbeats. More... | |
| uint32_t | max_unacked_clients_ |
| Maximum number of unacked clients. More... | |
| PeerConfigMap | peers_ |
| Map of peers' configurations. More... | |
| bool | send_lease_updates_ |
| Send lease updates to partner? More... | |
| StateMachineConfigPtr | state_machine_ |
| State machine configuration. More... | |
| bool | sync_leases_ |
| Synchronize databases on startup? More... | |
| uint32_t | sync_page_limit_ |
| Page size limit while synchronizing leases. More... | |
| uint32_t | sync_timeout_ |
| Timeout for syncing lease database (ms) More... | |
| std::string | this_server_name_ |
| This server name. More... | |
Storage for High Availability configuration.
Definition at line 29 of file ha_config.h.
| typedef std::map<std::string, PeerConfigPtr> isc::ha::HAConfig::PeerConfigMap |
Map of the servers' configurations.
Definition at line 162 of file ha_config.h.
| typedef boost::shared_ptr<PeerConfig> isc::ha::HAConfig::PeerConfigPtr |
Pointer to the server's configuration.
Definition at line 159 of file ha_config.h.
| typedef boost::shared_ptr<StateConfig> isc::ha::HAConfig::StateConfigPtr |
Pointer to the state configuration.
Definition at line 211 of file ha_config.h.
| typedef boost::shared_ptr<StateMachineConfig> isc::ha::HAConfig::StateMachineConfigPtr |
Pointer to a state machine configuration.
Definition at line 243 of file ha_config.h.
Mode of operation.
Currently supported modes are:
| Enumerator | |
|---|---|
| LOAD_BALANCING | |
| HOT_STANDBY | |
Definition at line 37 of file ha_config.h.
| isc::ha::HAConfig::HAConfig | ( | ) |
Constructor.
Definition at line 140 of file ha_config.cc.
|
inline |
Returns boolean flag indicating whether lease updates should be sent to the partner.
Definition at line 301 of file ha_config.h.
References send_lease_updates_.
|
inline |
Returns boolean flag indicating whether the active servers should synchronize their lease databases upon startup.
Definition at line 320 of file ha_config.h.
References sync_leases_.
|
inline |
Returns configurations of all servers.
Definition at line 477 of file ha_config.h.
References peers_.
| HAConfig::PeerConfigPtr isc::ha::HAConfig::getFailoverPeerConfig | ( | ) | const |
Returns configuration of the partner which takes part in failover.
The server for which the configuration is returned is a "primary", "secondary" or "standby". This method is typically used to locate the configuration of the server to which heartbeat command is to be sent.
| InvalidOperation | if there is no suitable configuration found. |
Definition at line 218 of file ha_config.cc.
References isc::ha::HAConfig::PeerConfig::BACKUP, getOtherServersConfig(), getThisServerName(), and isc_throw.
Here is the call graph for this function:
|
inline |
|
inline |
Returns heartbeat delay in milliseconds.
This value indicates the delay in sending a heartbeat command after last heartbeat or some other command to the partner. A value of zero disables the heartbeat.
Definition at line 374 of file ha_config.h.
References heartbeat_delay_.
|
inline |
Returns maximum time for a client trying to communicate with DHCP server to complete the transaction.
Definition at line 413 of file ha_config.h.
References max_ack_delay_.
|
inline |
Returns max response delay.
Max response delay is the maximum time that the server is waiting for its partner to respond to the heartbeats (and lease updates) before it assumes the communications interrupted state.
Definition at line 394 of file ha_config.h.
References max_response_delay_.
|
inline |
Returns maximum number of clients which may fail to communicate with the DHCP server before entering partner down state.
Definition at line 429 of file ha_config.h.
References max_unacked_clients_.
| HAConfig::PeerConfigMap isc::ha::HAConfig::getOtherServersConfig | ( | ) | const |
Returns configuration of other servers.
Returns a map of pointers to the configuration of all servers except this.
Definition at line 236 of file ha_config.cc.
References isc::data::copy(), getThisServerName(), and peers_.
Referenced by getFailoverPeerConfig().
Here is the call graph for this function:| HAConfig::PeerConfigPtr isc::ha::HAConfig::getPeerConfig | ( | const std::string & | name | ) | const |
Returns configuration of the specified server.
| name | Server name. |
| InvalidOperation | if there is no suitable configuration found. |
Definition at line 208 of file ha_config.cc.
References isc_throw, and peers_.
Referenced by getThisServerConfig().
|
inline |
Returns state machine configuration.
Definition at line 484 of file ha_config.h.
References state_machine_.
|
inline |
Returns maximum number of leases per page to be fetched during database synchronization.
Definition at line 355 of file ha_config.h.
References sync_page_limit_.
|
inline |
Returns timeout for lease database synchronization.
Definition at line 340 of file ha_config.h.
References sync_timeout_.
| HAConfig::PeerConfigPtr isc::ha::HAConfig::getThisServerConfig | ( | ) | const |
Returns configuration of this server.
Definition at line 231 of file ha_config.cc.
References getPeerConfig(), and getThisServerName().
Here is the call graph for this function:
|
inline |
Returns name of this server.
Definition at line 261 of file ha_config.h.
References this_server_name_.
Referenced by getFailoverPeerConfig(), getOtherServersConfig(), getThisServerConfig(), and validate().
|
static |
Returns HA mode name.
| ha_mode | HA mode which name should be returned. |
Definition at line 195 of file ha_config.cc.
References HOT_STANDBY, and LOAD_BALANCING.
Referenced by isc::ha::HAService::HAService().
| HAConfig::PeerConfigPtr isc::ha::HAConfig::selectNextPeerConfig | ( | const std::string & | name | ) |
Creates and returns pointer to the new peer's configuration.
This method is called during peers configuration parsing, when the parser starts reading configuration of the next peer on the list. It will store parsed values into this object.
| name | Name of the server for which new configuration should be created. |
| BadValue | if there is already a configuration for the given server name. |
Definition at line 148 of file ha_config.cc.
| void isc::ha::HAConfig::setHAMode | ( | const std::string & | ha_mode | ) |
Sets new mode of operation.
The following modes of operation are supported:
| ha_mode | High Availability mode operation in textual form. |
| BadValue | if non-supported mode of operation has been specified. |
Definition at line 178 of file ha_config.cc.
References ha_mode_, and stringToHAMode().
Here is the call graph for this function:
|
inline |
Sets new heartbeat delay in milliseconds.
This value indicates the delay in sending a heartbeat command after last heartbeat or some other command to the partner. A value of zero disables the heartbeat.
| heartbeat_delay | new heartbeat delay value. |
Definition at line 385 of file ha_config.h.
References heartbeat_delay_.
|
inline |
Sets maximum time for a client trying to communicate with DHCP server to completed the transaction.
| max_ack_delay | maximum time in milliseconds. |
Definition at line 421 of file ha_config.h.
References max_ack_delay_.
|
inline |
Sets new max response delay.
Max response delay is the maximum time that the server is waiting for its partner to respond to the heartbeats (and lease updates) before it assumes the communications interrupted state.
| max_response_delay |
Definition at line 405 of file ha_config.h.
References max_response_delay_.
|
inline |
Set maximum number of clients which may fail to communicate with the DHCP server before entering partner down state.
| max_unacked_clients | maximum number of clients. |
Definition at line 437 of file ha_config.h.
References max_unacked_clients_.
|
inline |
Sets boolean flag indicating whether lease updates should be sent to the partner.
Disabling lease updates is useful in cases when lease database replication is enabled, e.g. MySQL database replication. The database itself takes care of updating the backup database with new data. Sending lease updates is enabled by default.
| send_lease_updates | new value for the flag. |
Definition at line 314 of file ha_config.h.
References send_lease_updates_.
|
inline |
Sets boolean flag indicating whether the active servers should synchronize their lease databases upon startup.
Disabling lease database synchronization is useful in cases when lease database replication is enabled. See the description of the setSendLeaseUpdates. Lease database synchronization is enabled by default on active HA servers.
| sync_leases | new value for the flag. |
Definition at line 333 of file ha_config.h.
References sync_leases_.
|
inline |
Sets new page limit size for leases fetched from the partner during database synchronization.
| sync_page_limit | New page limit value. |
Definition at line 363 of file ha_config.h.
References sync_page_limit_.
|
inline |
Sets new lease database syncing timeout in milliseconds.
| sync_timeout | new timeout for lease database synchornization. |
Definition at line 347 of file ha_config.h.
References sync_timeout_.
| void isc::ha::HAConfig::setThisServerName | ( | const std::string & | this_server_name | ) |
Sets name of this server.
| this_server_name | This server name. |
| BadValue | If the provided server name is empty. |
Definition at line 166 of file ha_config.cc.
References isc_throw, this_server_name_, and isc::util::str::trim().
Here is the call graph for this function:
|
static |
Decodes HA mode provided as string.
| ha_mode | HA mode as string. |
| BadValue | if specified HA mode name is unsupported. |
Definition at line 183 of file ha_config.cc.
References HOT_STANDBY, isc_throw, and LOAD_BALANCING.
Referenced by setHAMode().
| void isc::ha::HAConfig::validate | ( | ) | const |
Validates configuration.
| HAConfigValidationError | if configuration is invalid. |
Definition at line 243 of file ha_config.cc.
References getThisServerName(), ha_mode_, HOT_STANDBY, isc_throw, LOAD_BALANCING, peers_, isc::ha::HAConfig::PeerConfig::PRIMARY, isc::ha::HAConfig::PeerConfig::SECONDARY, and isc::ha::HAConfig::PeerConfig::STANDBY.
Here is the call graph for this function:| HAMode isc::ha::HAConfig::ha_mode_ |
Mode of operation.
Definition at line 494 of file ha_config.h.
Referenced by getHAMode(), setHAMode(), and validate().
| uint32_t isc::ha::HAConfig::heartbeat_delay_ |
Heartbeat delay in milliseconds.
Definition at line 500 of file ha_config.h.
Referenced by getHeartbeatDelay(), and setHeartbeatDelay().
| uint32_t isc::ha::HAConfig::max_ack_delay_ |
Maximum DHCP message ack delay.
Definition at line 502 of file ha_config.h.
Referenced by getMaxAckDelay(), and setMaxAckDelay().
| uint32_t isc::ha::HAConfig::max_response_delay_ |
Max delay in response to heartbeats.
Definition at line 501 of file ha_config.h.
Referenced by getMaxResponseDelay(), and setMaxResponseDelay().
| uint32_t isc::ha::HAConfig::max_unacked_clients_ |
Maximum number of unacked clients.
Definition at line 503 of file ha_config.h.
Referenced by getMaxUnackedClients(), and setMaxUnackedClients().
| PeerConfigMap isc::ha::HAConfig::peers_ |
Map of peers' configurations.
Definition at line 504 of file ha_config.h.
Referenced by getAllServersConfig(), getOtherServersConfig(), getPeerConfig(), selectNextPeerConfig(), and validate().
| bool isc::ha::HAConfig::send_lease_updates_ |
Send lease updates to partner?
Definition at line 495 of file ha_config.h.
Referenced by amSendingLeaseUpdates(), and setSendLeaseUpdates().
| StateMachineConfigPtr isc::ha::HAConfig::state_machine_ |
State machine configuration.
Definition at line 505 of file ha_config.h.
Referenced by getStateMachineConfig().
| bool isc::ha::HAConfig::sync_leases_ |
Synchronize databases on startup?
Definition at line 496 of file ha_config.h.
Referenced by amSyncingLeases(), and setSyncLeases().
| uint32_t isc::ha::HAConfig::sync_page_limit_ |
Page size limit while synchronizing leases.
Definition at line 498 of file ha_config.h.
Referenced by getSyncPageLimit(), and setSyncPageLimit().
| uint32_t isc::ha::HAConfig::sync_timeout_ |
Timeout for syncing lease database (ms)
Definition at line 497 of file ha_config.h.
Referenced by getSyncTimeout(), and setSyncTimeout().
| std::string isc::ha::HAConfig::this_server_name_ |
This server name.
Definition at line 493 of file ha_config.h.
Referenced by getThisServerName(), and setThisServerName().