Alexander Kukushkin
3e8855799f
Add requirements.txt
2015-05-19 09:14:13 +02:00
Alexander Kukushkin
f7b6c8df40
Merge branch 'master' of github.com:CyberDem0n/governor
...
Conflicts:
helpers/postgresql.py
2015-05-18 15:58:38 +02:00
Alexander Kukushkin
e9ffcf9efe
Small refactoring of initdb call
2015-05-18 15:57:24 +02:00
Alexander Kukushkin
520de12232
Remove debug print
2015-05-18 14:39:14 +02:00
Alexander Kukushkin
a9b50b4e2e
Merge branch 'master' of github.com:CyberDem0n/governor
2015-05-18 14:34:17 +02:00
Alexander Kukushkin
ce936ceee2
Merge branch 'master' of github.com:compose/governor
...
Conflicts:
governor.py
helpers/ha.py
helpers/postgresql.py
2015-05-18 14:33:27 +02:00
Alexander Kukushkin
422512880f
last_leader_operation is the propery of Cluster object and the value is set in get_cluster method
2015-05-18 13:43:14 +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
d221d1de1c
listen_address can have more then one value separated by comma. We will use the first one to connect
2015-05-18 10:53:27 +02:00
Alexander Kukushkin
348100752b
Open connection to self via listen address
2015-05-15 16:18:31 +02:00
Alexander Kukushkin
af9ebfa3b9
Use connect_address instead of listen when building connection_string
2015-05-15 12:20:24 +02:00
Alexander Kukushkin
75ff91d017
rename connection_address to connect_address
2015-05-15 12:13:05 +02:00
Alexander Kukushkin
08865512f8
Differentiate between connection address and listen address
...
For example you can listen on 0.0.0.0 but provide service on some
didicated ip. This should cover all possible use-cases when you are
running behind firewall, load balancer or inside for example docker.
2015-05-15 12:06:04 +02:00
Alexander Kukushkin
274bc14bfb
Do not check maximum_lag_on_failover if it is not defined in config file
2015-05-15 11:38:50 +02:00
Alexander Kukushkin
8e5beb5883
Small optimization
2015-05-15 11:25:26 +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
4e8a0873a7
Handle sigchld, so we can run governor and postgres inside docker safely
2015-05-13 18:05:42 +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
Alexander Kukushkin
8b38dbd2b5
Put governor code into class and implement sigterm processing handler
2015-05-12 13:48:06 +02:00
Alexander Kukushkin
281b0b8455
Bugfix in has_lock: sometimes leader can be undefined
2015-05-12 11:07:52 +02:00
Alexander Kukushkin
9dcbc75fd2
Bugfix. It wasn't possible to start the old cluster if all its members were shutdown.
...
Basically this is rollback to the original decision tree with the small exception:
1 - If leader is defined and it's not me - then slave would be started immidiately
with the correct recovery conf.
2 - If leader is defined in and it's my host, then it will start instance in
readonly (but without primary_conninfo in recovery.conf)
3 - And the third case - if the leader is not defined - it also will start
instance in readonly, without primary_conninfo.
After performing 2 or 3 it will perform usual decision tree.
2015-05-12 10:19:45 +02: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
6d17d39776
Backport from compose/governor: compare xlog positions based on bytes since 0/000000 based on feedback
2015-05-11 10:06:18 +02:00
Alexander Kukushkin
2e3eb333cb
Shutdown fast
2015-05-11 09:48:59 +02:00
Alexander Kukushkin
0b288a7f3e
Track list of already existing physical replication slots
...
Drop replication slot when it was removed from etcd.
Execute pg_create_physical_replication_slot only when something new appeared in etcd.
2015-05-11 09:48:15 +02:00
Alexander Kukushkin
8cfbdcfcd4
Track list of already existing physical replication slots
...
Drop replication slot when it was removed from etcd.
Execute pg_create_physical_replication_slot only when something new appeared in etcd.
2015-05-11 09:44:57 +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
3a6afe5a9b
Set environment variable PGPASSFILE via os.environ before running pg_basebackup and unset it afterwards
2015-05-08 16:32:57 +02:00
Alexander Kukushkin
72010f68cc
Bugfix: two calls has_lock and update_lock are not atomic
...
Having a lock a few moments ago, doesn't mean that you will be able to
update it.
2015-05-08 16:21:09 +02:00
Alexander Kukushkin
810808a68a
Format code according to pep8.
...
replace get_client_path("/members?recursive=true") with members()
replace do-plpgsq block by simple sql
2015-05-08 12:44:28 +02:00
Alexander Kukushkin
61f0cb2fb4
dempote and follow_the_leader have the same functionality
...
Now methods supporting the case when leader is not defined. There would
be no primary_conninfo in recovery.conf. I like it more comparing to
postgres://169.0.0.1:5432
2015-05-08 12:28:00 +02:00
Alexander Kukushkin
40b20ce5d7
Start postmaster and run initdb with pg_ctl
...
It will wait utill postgres started up and helps to get rid from magic time.sleep(5) in start method.
2015-05-06 18:26:28 +02:00
Alexander Kukushkin
2fd1614144
query method now allow to execute sql with parameters
2015-05-06 17:52:39 +02:00
Alexander Kukushkin
1d5f3b1fff
Do not write primary_conninfo into recovery.conf during start
2015-05-06 16:21:49 +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
Alexander Kukushkin
a6d5732da3
Inerit HealthiestMemberError and CurrentLeaderError from EtcdError
2015-05-06 14:45:49 +02:00
Alexander Kukushkin
c75bb2b297
Format code according to pep8
2015-05-06 14:39:15 +02:00
Alexander Kukushkin
0c776f5d86
Small bugfixes
2015-05-06 14:11:37 +02:00
Alexander Kukushkin
e108fec30a
Try to replace % formatting with .format()
2015-05-06 13:48:16 +02:00
Alexander Kukushkin
6f3476a924
Try to replace % formatting with .format()
2015-05-06 13:09:11 +02:00
Alexander Kukushkin
5fc770a370
Got rid of unneeded calls of os.system
2015-05-06 12:38:18 +02:00
Alexander Kukushkin
4e786c1519
Format code according to pep8
2015-05-06 12:12:37 +02:00