Alexander Kukushkin
60a360a4da
Reset _machines_cache before doing next load attempt
2015-08-26 15:17:24 +02:00
Alexander Kukushkin
befd33555d
Refactor helpers/etcd.py
...
Work with etcd cluster via high-level python-etcd module.
Plus change all unit tests accordingly.
2015-08-24 16:58:08 +02:00
Alexander Kukushkin
a1f11fe2fe
Remove unneeded class CurrentLeaderError
2015-07-08 08:53:08 +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
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
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
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
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
a64dad267e
Bugfix: target field of SRV object should be casted to string
2015-06-09 15:46:34 +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
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
Alexander Kukushkin
fca987deda
set value of api_url from application_name parameter of conn_url. Reset parameters of conn_url
2015-06-02 09:45:37 +02:00
Alexander Kukushkin
f9ce29d49f
rename address to conn_url in a Member obj
...
and introduce new field: api_url
2015-06-02 08:52:34 +02:00
Alexander Kukushkin
aa486194ae
Wrap time.sleep into wrapper function
...
In case if it was interrupted by SIGCHLD but scheduled awake time is not
reached it will continue sleeping. For all other signals behaviuor is
not changed.
2015-05-28 15:47:51 +02:00
Alexander Kukushkin
faf295dcd0
Add initialize key into Cluster
2015-05-24 19:26:35 +02:00
Alexander Kukushkin
8dd99170bf
Refactor exceptions handling in etcd.py and ha.py
...
update_leader can throw EtcdError exception
unused HealthiestMemberError exception is removed
2015-05-24 15:40:36 +02:00
Alexander Kukushkin
62d17d68de
Use "member_ttl" with default value=3600 for members
2015-05-22 12:00:07 +02:00
Alexander Kukushkin
bb884bac00
Move is_unlocked method from Ha into Cluster class
2015-05-22 11:45:09 +02:00
Alexander Kukushkin
3533b790cb
Update list of success return codes for PUT and DELETE
2015-05-20 12:03:12 +02:00
Alexander Kukushkin
b24fb0488c
last_leader_operation is the propery of Cluster object and the value is set in get_cluster method
2015-05-18 13:33:27 +02:00
Alexander Kukushkin
9487aec842
Bugfix: get_client_path might get into infinite loop when response code is not 200
2015-05-15 11:23:02 +02:00
Alexander Kukushkin
e6e19359df
Bugfix, write state_handler.name into leader key
2015-05-13 18:04:27 +02:00
Alexander Kukushkin
0c040b8ce2
Merge branch 'master' of github.com:compose/governor
...
Conflicts:
governor.py
helpers/etcd.py
helpers/ha.py
helpers/postgresql.py
2015-05-13 18:01:01 +02:00
Alexander Kukushkin
40a4192504
Remove member and leader (is I was the master) keys from etcd on stop of governor
2015-05-13 17:12:17 +02:00
Alexander Kukushkin
d25ad17c32
Add support of python3
2015-05-13 14:53:23 +02:00
Christopher Winslett
557bad37cd
ensure a stale Postgres does not become leader
2015-05-12 18:11:12 -07:00
Christopher Winslett
a1bc07db33
use TTLs with member listing to keep a current list of cluster members
2015-05-12 16:33:32 -07:00
Alexander Kukushkin
be7677a1b8
Bugfix, hostname and address are not keys of dict but properties of Member object
2015-05-12 09:08:45 +02:00
Alexander Kukushkin
e2faf641d5
Start slave with the correct recovery.conf on governor start
...
Also governor is able to pick up already running master and slave
instances without restarting them.
In case is you have a lock and postgres is not running behaviour remains
the same: it will start master in read only mode and then promote if it
still has the lock.
2015-05-11 16:50:21 +02:00
Alexander Kukushkin
eb1721f65f
Minimize amount of requests to etcd
2015-05-11 15:15:08 +02:00
Alexander Kukushkin
588c951a86
Return True after success call of update_leader and check return code
2015-05-11 08:48:51 +02:00
Alexander Kukushkin
1545cc834d
Try to replace % formatting with .format()
2015-05-06 14:57:01 +02:00
Alexander Kukushkin
83ff6986d5
Format code according to pep8
2015-05-06 14:49:07 +02:00
Christopher Grim
b979c12c9d
Use timestamped logs
2015-04-03 17:27:47 -04:00
Anthony Scalisi
f167bbaddc
python tweaks
2015-03-26 12:35:20 -07:00
Christopher Winslett
0d75152d54
make healthiest node work
2015-03-16 09:47:52 -07:00
Christopher Winslett
3749883328
first commit
2015-03-15 23:16:48 -07:00