Oleksii Kliukin
2089a123c2
fix line too long warning.
2015-08-03 11:48:02 +02:00
Oleksii Kliukin
7f2dcc0a95
Move replica creation code into a separte file. So far, only the class that makes replicas with pg_basebackup is called.
2015-08-03 11:44:11 +02:00
Oleksii Kliukin
6fdd0304f6
Merge pull request #7 from zalando/feature/callbacks
...
Implement callback actions for patroni in order to call external script on different events in the server lifecycle, supported are on start, stop, restart, reload and role change (which covers both promote and demote). A callback should receive 3 arguments: action, role and cluster name (in this order), and can do things like tagging the EC2 instances associated with PostgreSQL, or notifying the DBA when the master had been demoted.
A sample callback that assigns tags to AWS instances is provided.
2015-07-30 10:29:08 +02:00
Oleksii Kliukin
a0fdd6398f
Cosmetic changes: avoid magic strings in action names, name the parameter passed to the callback 'scope' for consistency.
2015-07-30 10:17:17 +02:00
Oleksii Kliukin
71a1200f64
Fix a mistake in checking for the number of parameters.
2015-07-29 12:09:17 +02:00
Oleksii Kliukin
5171964758
Merge branch 'master' into feature/callbacks
2015-07-27 16:19:03 +02:00
Oleksii Kliukin
5c5bae69ea
make sure we can import from scripts.
2015-07-27 16:11:58 +02:00
Oleksii Kliukin
27bda5b4e4
document the new callbacks option.
2015-07-27 13:12:08 +02:00
Oleksii Kliukin
7d1bc32ad9
potentially run the doctests for the scripts.
2015-07-27 13:06:44 +02:00
Oleksii Kliukin
d85451efae
Increase test coverage for aws script.
2015-07-27 13:04:45 +02:00
Oleksii Kliukin
b92bfb34a5
Futher test for postgresql module (includes callbacks)
2015-07-27 13:04:01 +02:00
Oleksii Kliukin
56983d867d
Run coverage test for the data in scripts as well as helpers.
2015-07-27 13:03:12 +02:00
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
859da0db0a
Make unit tets run again.
2015-07-27 10:10:29 +02:00
Oleksii Kliukin
dac3d7997f
Change a typo.
2015-07-24 10:47:26 +02:00
Oleksii Kliukin
35fe536e8b
Set +x bit on aws.py
2015-07-23 17:09:39 +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
f1d76611b6
Use the executable bit on AWS callback.
2015-07-17 17:26:52 +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
Alexander Kukushkin
d1e47c8ccf
Update README.md
2015-07-15 16:17:38 +02:00
Alexander Kukushkin
fcead3aed9
Update README.md
2015-07-15 15:25:20 +02:00
Alexander Kukushkin
b6c2061f3a
Merge branch 'master' of github.com:zalando/patroni into feature/six
2015-07-15 12:49:51 +02:00
Alexander Kukushkin
26935c3725
Merge branch 'master' of github.com:zalando/patroni into feature/lost-dcs-data
2015-07-15 12:49:38 +02:00
Alexander Kukushkin
66f4f790d2
Improve test coverage
2015-07-15 12:49:17 +02:00
Alexander Kukushkin
9df783cf9d
use six module to support python 2 and 3 instead of conditional imports
2015-07-15 12:03:28 +02:00
Alexander Kukushkin
b54119b918
Run is_healthiest_node against last know healthy configuration of cluster
...
This will help to survive when everything was wiped from configuration
store.
2015-07-15 11:20:25 +02:00
Oleksii Kliukin
d8aa1ff849
fix a typo.
2015-07-14 09:22:49 +02:00
Oleksii Kliukin
15f94f4224
Use actual role name and not boolean flag if it is a master to tag AWS objects (EBS volumes and EC2 instances).
2015-07-13 11:47:55 +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
Alexander Kukushkin
6d1a0d2a2c
Merge pull request #2 from zalando/feature/exhibitor
...
Feature/exhibitor
2015-07-13 11:14:59 +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
Alexander Kukushkin
71fce312c2
Enforce flake8 check
2015-07-10 10:53:04 +02:00
Alexander Kukushkin
dcad7a3229
Add exhibitor support
...
List of ZooKeeper nodes could be periodically updated from Exhibitor
Since we know that each Exhibitor accompanies one ZooKeeper node, list
of Exhibitor nodes also maintained. Exhibitor assumes that all ZooKeeper
nodes are using the same client port, 2181. The same assumption is valid
for Exhibitor, it should always listen on the same port on all nodes.
Original list of Exhibitor nodes is cached and used as a fallback when
it failed ito query information with using maintained list.
2015-07-10 10:46:33 +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
Feike Steenbergen
76b22e7ad8
Update README.md
2015-07-08 12:23:53 +02:00
Alexander Kukushkin
e2def822b7
Delete haproxy_status.sh
2015-07-08 11:50:16 +02:00
Alexander Kukushkin
b36764b517
Update README.md
2015-07-08 11:49:16 +02:00
Alexander Kukushkin
74c3955d34
Merge pull request #29 from zalando/patroni
...
Rename governor into patroni
2015-07-08 11:24:31 +02:00
Alexander Kukushkin
cc291ecf1b
Add Zalando to copyright
2015-07-08 11:16:33 +02:00
Alexander Kukushkin
c49580d6a7
Rename governor into patroni
2015-07-08 10:37:35 +02:00
Alexander Kukushkin
c24087ebd7
Merge pull request #28 from zalando/feature/multidcs
...
Feature/multidcs
2015-07-08 10:19:40 +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
00aa99b38f
Revert restapi port to 8009
2015-07-08 08:53:51 +02:00