Commit Graph
210 Commits
Author SHA1 Message Date
Oleksii Kliukin 115ba1d9ae Make sure postgresql.stop also return True if pg_ctl stop returned 0. 2015-07-27 11:23:08 +02:00
Oleksii Kliukin 201f9bf4b2 Make sure role check during callbacks does not accidentially modify the cluster state (is_promoted flag or trigger file). 2015-07-27 11:08:19 +02:00
Oleksii Kliukin dac3d7997f Change a typo. 2015-07-24 10:47:26 +02:00
Oleksii Kliukin c9c678fb5b Pass scope, the cluster name, instead of the name, which is the instance name, to the callback. 2015-07-23 16:16:22 +02:00
Oleksii Kliukin e9934be9aa Do not terminate on callback failure.
Show the error if a callback command fails and move on.
Set the executable bit for the aws callback.
2015-07-17 17:26:28 +02:00
Oleksii Kliukin a11d94aff5 Pass text names of cluster roles to the script.
Seems better than passing a bool flag and
converting it from/to string.
2015-07-17 15:39:34 +02:00
Oleksii Kliukin 33b5e1b22e Make sure is_leader is False does not trigger the leader re-check. 2015-07-17 15:22:21 +02:00
Oleksii Kliukin 11004f8c48 Be more robust on callbacks when cluster is down.
For 'on_stop' or 'on_restart' callbacks we cannot
call is_leader, because the cluster would be stopped.

Instead, call is_leader before running a callback.
In addition, make the call_nowait more robust by handling
the exceptions related to the DB cluster unavailability.
2015-07-17 11:19:05 +02:00
Oleksii Kliukin d8aa1ff849 fix a typo. 2015-07-14 09:22:49 +02:00
Oleksii Kliukin f734272f3f Process the command paths relative to the patroni dir correctly, fix the error of not supplying a callback action to the actual command. 2015-07-13 11:45:25 +02:00
Oleksii Kliukin 6d0a9bbdc0 create a new directory for callback scripts and move aws volume tags there. 2015-07-13 10:25:42 +02:00
Oleksii Kliukin c0cc590938 Remove usage of AWS.py from Patroni
Functionality provided by that module will be achieved via callbacks.
- fix a typo in aws.py
- fix some mixups of old code and new callbacks in postgresql.py
2015-07-10 12:58:37 +02:00
Oleksii Kliukin 78f0b16543 Enable aws.py to run as a stand-alone program. 2015-07-10 10:57:24 +02:00
Oleksii Kliukin 2c1627c2f3 get rid of yaml module, since AWS instance-identity natively sends JSON. 2015-07-10 10:33:07 +02:00
Oleksii Kliukin aa5a72fb37 Add on_start, on_stop, on_role_change, on_restart and on_reload callbacks. 2015-07-09 15:45:10 +02:00
Alexander Kukushkin c49580d6a7 Rename governor into patroni 2015-07-08 10:37:35 +02:00
Alexander Kukushkin 259c3ac341 Merge branch 'multidcs' of github.com:CyberDem0n/governor into feature/multidcs 2015-07-08 08:54:02 +02:00
Alexander Kukushkin a1f11fe2fe Remove unneeded class CurrentLeaderError 2015-07-08 08:53:08 +02:00
Alexander Kukushkin 54400c6dec Merge branch 'multidcs' of github.com:CyberDem0n/governor into feature/multidcs
Conflicts:
	governor.py
	tests/test_governor.py
	tests/test_postgresql.py
2015-07-08 08:47:26 +02:00
Alexander Kukushkin 43b12af3a7 Implement possibility to work against ZooKeeper
This implementation is using the same interface (AbstractDCS) as Etcd
class. It means that there should be no problem to implement another
plugin to work agains Consul for example.
2015-07-07 12:45:14 +02:00
Alexander Kukushkin 7445590546 Keep node name in AbstractDCS class
It eliminates need to pass this name into most of the methods
2015-07-07 12:26:52 +02:00
Alexander Kukushkin 1531304baa return result of last_operation as a string 2015-07-07 12:23:06 +02:00
Alexander Kukushkin ae689a2f83 Rename ha.etcd into ha.dcs 2015-07-02 15:33:21 +02:00
Alexander Kukushkin cc71906009 Inherit Etcd from abstract class 2015-07-02 15:15:07 +02:00
Alexander Kukushkin 6079c8359f refactoring: preparing to support ZooKeeper
move some common classes info separate file in preparation to support distributed configuration store other then Etcd
2015-07-02 12:06:07 +02:00
Alexander Kukushkin c7210d35ff Merge pull request #27 from CyberDem0n/master
BUGFIX: keep list of replication slots on slaves empty
2015-06-25 14:20:10 +02:00
Alexander Kukushkin 9732106e5d BUGFIX: keep list of replication slots on slaves empty
Otherwise slaves accumulate wal files...
2015-06-25 14:01:06 +02:00
Alexander Kukushkin ffdd3b3d8e Merge branch 'master' of github.com:CyberDem0n/governor 2015-06-24 16:42:08 +02:00
Alexander Kukushkin a02f9d497f BUGFIX: it can be that /members request to etcd returns somesing strange with status_code 200 2015-06-24 16:41:37 +02:00
Alexander Kukushkin 10d992a974 Merge pull request #26 from CyberDem0n/master
Reduce amount of writes into etcd
2015-06-24 16:39:50 +02:00
Alexander Kukushkin f7be52f63a real_ttl method will return -1 when expiration is not defined 2015-06-23 17:15:37 +02:00
Alexander Kukushkin b7c73fdba8 Rename hostname to name in a Member 2015-06-23 14:07:00 +02:00
Alexander Kukushkin 744026b4bb Do not update member TTL when it is far from being expired 2015-06-23 14:02:32 +02:00
Alexander Kukushkin 44e06b4cff Add expiration field into Member 2015-06-10 14:22:11 +02:00
Alexander Kukushkin 72b980bd97 Merge branch 'etcd-cluster-support' of github.com:CyberDem0n/governor 2015-06-10 11:58:48 +02:00
Alexander Kukushkin 971bc3b6e8 Increase verbosity of failed PUT and DELETE requests. Hope will help to debug some etcd related issues 2015-06-10 11:56:16 +02:00
Alexander Kukushkin 3f47e9e362 Merge branch 'etcd-cluster-support' of github.com:CyberDem0n/governor 2015-06-09 15:47:06 +02:00
Alexander Kukushkin a64dad267e Bugfix: target field of SRV object should be casted to string 2015-06-09 15:46:34 +02:00
Alexander Kukushkin de7630c65c Merge branch 'etcd-cluster-support' of github.com:CyberDem0n/governor into etcd-cluster-support 2015-06-09 12:31:09 +02:00
Alexander Kukushkin 57914821d0 Randomize list of etcd cluster members 2015-06-09 12:30:58 +02:00
Alexander Kukushkin a2988361c5 Retry with host from config when it failed to resolve SRV 2015-06-09 12:30:16 +02:00
Alexander Kukushkin 19b0d4701b Merge branch 'etcd-cluster-support' of github.com:CyberDem0n/governor into etcd-cluster-support
Conflicts:
	requirements-py2.txt
	tests/test_governor.py
2015-06-09 11:34:14 +02:00
Alexander Kukushkin 261fbf2721 Replace logging with logger in ha.py 2015-06-09 10:27:09 +02:00
Alexander Kukushkin da4f9e8445 Make logging of http requests more verbose 2015-06-09 10:25:33 +02:00
Alexander Kukushkin c79fba7656 Support work with etcd as a cluster
In case if one member of a cluster is not available it will retry with
another one and fetch the new cluster configuration. Default timeout for
all requests to etcd is 5 seconds.
Initial cluster configuration can be resolved through:
1) /v2/members call on one of the cluster members on a client port
2) when it is possible to resolve hostname into multiple ip's  it will
iterate through list and try to perform action from 1)
3) If there is discovery_srv defined in etcd section of config file it
will resolve peer addresses of all cluster members and will fetch
cluster configuration with using peer protocol by doing /members call on
a peer port
2015-06-09 09:51:53 +02:00
Oleksii Kliukin 16a068f795 use instance-identity/document URL part to get instanceid and region at once. 2015-06-05 17:07:10 +02:00
Oleksii Kliukin 8ab7717f13 increase test coverage for the changes in postgresql.py 2015-06-05 10:03:42 +02:00
Oleksii Kliukin cdc7526216 Merge branch 'master' into feature/awstags 2015-06-05 09:50:17 +02:00
Oleksii Kliukin 20c785b63a python3 compatibility: use isinstance instead of type() 2015-06-05 09:44:47 +02:00
Oleksii Kliukin 553b26f385 call on_change_callback only if it has been set. 2015-06-05 09:01:42 +02:00