Motr
M0
|
Redundant configuration client library – rconfc – provides an interface for Motr applications working in cluster with multiple configuration servers (confd).
Rconfc supplements confc functionality and processes situations when cluster dynamically changes configuration or loses connection to some of confd servers.
m0_rconfc structure includes a dedicated m0_confc instance m0_rconfc::rc_confc, which is intended for conventional configuration reading.
Beside of that, it contains two lists of confc instances, the one used for communication with multiple confd servers in cluster environment during configuration version election, and the other one used for keeping list of discovered confd servers that run the same version that has won in the most recent election.
To access configuration data the configuration consumer is allowed to follow two different scenarios:
In the first case the consumer reads data from particular confd server with no regard to whether its version reached quorum or not.
In the second case the consumer is guaranteed to read data from configuration that reached the quorum in the cluster, i.e. the most recent consistent one. As well, the consumer is guaranteed to be notified about the fact of configuration change, to let accommodate with the change if required. In addition, the ability to switch among confd servers in case of network error transparently for the consumer sufficiently strengthens the reading reliability, and due to this, cluster robustness in whole.
In the latter case the consumer initialises and starts m0_rconfc instance instead of m0_confc, and performs all further reading via m0_rconfc::rc_confc.
Also, the consumer using rconfc doesn't provide any confd addresses explicitly. The list of confd servers and other related information is centralised and is maintained by HA service. Rconfc queries this information on startup.
Example:
For asynchronous rconfc start/stop please see details of m0_rconfc_start_sync(), m0_rconfc_stop_sync() implementation or documentation for m0_rconfc_start(), m0_rconfc_stop().