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
41942ee722
Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
2015-05-12 09:09:49 +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
Oleksii Kliukin
35b111083c
Change the governor health check default port to 8008 in order to avoid a conflict with etcd proxy.
2015-05-11 17:55:00 +02:00
Alexander Kukushkin
1370923e84
Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
2015-05-11 16:58:26 +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
Feike Steenbergen
82afc554d6
Merge pull request #2 from zalando/feature/status_page
...
Created statuspage, a health check for a PostgreSQL cluster served usi…
2015-05-11 16:25:28 +02:00
Alexander Kukushkin
eb1721f65f
Minimize amount of requests to etcd
2015-05-11 15:15:08 +02:00
Feike Steenbergen
e7adb69503
Start the http request handler for load balancing as a thread in Governor.
...
When not running standalone, some better referencing to the Postgresql instance was needed.
2015-05-11 13:11:09 +02:00
Feike Steenbergen
91b71f8579
Created tatuspage, a health check for a PostgreSQL cluster served using http.
...
The StatusPage uses a BaseHTTPServer to server 3 simple http endpoints:
- pg_master, returns 200 if PostgreSQL is running as master
- pg_slave, returns 200 if PostgreSQL is running as slave
- pg_status, returns some information about the cluster
It does this by relying on the PostgreSQL connection of the Governor.
2015-05-11 11:46:01 +02:00
Alexander Kukushkin
42d9c08c37
Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
2015-05-11 10:06:29 +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
b3d6997289
Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
2015-05-11 09:54:28 +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
Christopher Winslett
36c4c31e83
compare xlog positions based on bytes since 0/000000 based on feedback
2015-05-10 19:36:59 -07:00
Alexander Kukushkin
db7a38f025
Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
2015-05-08 16:33:41 +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
d9f3b232c5
Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
...
Conflicts:
helpers/postgresql.py
2015-05-08 13:36:49 +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
Feike Steenbergen
0b053e3b33
Created a Dockerfile to be able to run Governor using a local etcd.
...
Usefull for developing and testing the Governor locally.
2015-05-07 13:17:28 +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
Christopher Winslett
1879b9c76a
fix state queries against secondaries
2015-05-04 13:39:30 -07:00
Oleksii Kliukin
39667f6e92
allow connections for all hosts and ports, not just postgres.
2015-04-30 12:11:46 +02:00
Oleksii Kliukin
221ba39c0f
Remove WITH invokations from CREATE ROLE.
2015-04-30 12:04:57 +02:00
Oleksii Kliukin
e8345e5e90
fix a typo.
2015-04-30 11:56:13 +02:00
Oleksii Kliukin
10dbf990f1
Allow md5 connections from outside and create connection roles.
...
Create a superuser role with a given name and password (or change
the postgres role if the name is not given). Also, create an admin
role with the name and the password provided. The admin role has
CREATEDB and CREATEROLE permisssions, effectively making it the
most powerful role after the superuser.
2015-04-30 10:58:07 +02:00
Oleksii Kliukin
8184efbf45
Add an option to use AWS instance address in a PostgreSQL connection string.
...
When PostgreSQL is running inside the docker container, it should provide
the address of the host it's running on and not the address from inside
of the container to the outside world.
2015-04-29 12:54:29 +02:00
Anthony Scalisi
5facf8638e
support multiple recovery params
2015-04-24 13:42:18 -05:00
Oleksii Kliukin
c3ea0ebccd
use samehost instead of the host's ip address.
2015-04-24 18:06:20 +02:00
Oleksii Kliukin
60db8d6adb
Allow connections to the host's own IP address from the host itself.
2015-04-24 16:23:38 +02:00
Christopher Winslett
772185728d
update README based on @pires's recommendation #6
2015-04-22 14:26:09 -04:00
Christopher Winslett
e5e12f9a99
Merge pull request #5 from bookest/logging
...
Use timestamped logs
2015-04-04 08:00:25 -07:00
Christopher Grim
b979c12c9d
Use timestamped logs
2015-04-03 17:27:47 -04:00
Christopher Winslett
6850bdce78
Merge pull request #4 from scalp42/fixes
...
Couple tweaks
2015-03-29 18:45:07 -07:00