Switch DNS aggregator to PostgreSQL
MariaDB+Galera was terribly unstable, with the cluster failing to start or dying randomly, and generally seemed incredibly unsuitable for an HA solution. This commit switches the DNS aggregator SQL backend to PostgreSQL, implemented via Patroni HA. It also manages the Patroni state, forcing the primary instance to follow the PVC coordinator, such that the active DNS Aggregator instance is always able to communicate read+write with the local system. This required some logic changes to how the DNS Aggregator worked, specifically ensuring that database changes aren't attempted while the instance isn't actively running - to be honest this was a bug anyways that had just never been noticed. Closes #34
This commit is contained in:
@ -269,7 +269,26 @@ class NodeInstance(object):
|
||||
for network in self.d_network:
|
||||
self.d_network[network].createGateways()
|
||||
self.d_network[network].startDHCPServer()
|
||||
time.sleep(0.5)
|
||||
time.sleep(1)
|
||||
# Force Patroni to switch to the local instance
|
||||
self.logger.out('Setting Patroni leader to this node', state='i')
|
||||
retcode, stdout, stderr = common.run_os_command(
|
||||
"""
|
||||
patronictl
|
||||
-c /etc/patroni/config.yml
|
||||
-d zookeeper://localhost:2181
|
||||
switchover
|
||||
--candidate {}
|
||||
--force
|
||||
pvcdns
|
||||
""".format(self.name)
|
||||
)
|
||||
if stdout:
|
||||
self.logger.out('Successfully switched Patroni leader\n{}'.format(stdout), state='o')
|
||||
else:
|
||||
self.logger.out('Failed to switch Patroni leader\n{}'.format(stderr), state='e')
|
||||
time.sleep(1)
|
||||
# Start the DNS aggregator instance
|
||||
self.dns_aggregator.start_aggregator()
|
||||
|
||||
def createFloatingAddresses(self):
|
||||
|
Reference in New Issue
Block a user