Commit Graph
129 Commits
Author SHA1 Message Date
Feike Steenbergen ea416d98d7 Api: Bugfix for current_xlog_location in slaves. 2015-05-26 15:40:32 +02:00
Oleksii Kliukin 7217d0b0c1 Fix typos when passing connection parameters to psycopg2. 2015-05-26 10:35:42 +02:00
Alexander Kukushkin bbf1110518 Merge branch 'restapi' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	governor.py
	helpers/postgresql.py
	postgres0.yml
	postgres1.yml
	tests/test_postgresql.py
2015-05-26 09:56:35 +02:00
Alexander Kukushkin 518ef68a53 Use connect_timeout=3s and statement_timeout=2s everywhere (even for local connections) 2015-05-26 09:19:20 +02:00
Alexander Kukushkin faf295dcd0 Add initialize key into Cluster 2015-05-24 19:26:35 +02:00
Alexander Kukushkin 1096e04343 Bigfix, cursor.closed contains boolean value 2015-05-24 16:00:31 +02:00
Alexander Kukushkin db34e1f458 Write get_postgresql_status exception into log file 2015-05-24 15:57:10 +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 188741de5a Merge branch 'master' of github.com:CyberDem0n/governor into restapi 2015-05-24 09:02:42 +02:00
Alexander Kukushkin ce267d9f1e query method will retry only in case of communication error 2015-05-24 09:01:23 +02:00
Alexander Kukushkin d202f72a42 Added simple web server which shows current state of postgres
Server always returns json which contains some status of postgres:
* instance type: master/slave
* xlog location for master
* xlog received_location, replayed_location
This server could be used by haproxy
GET / returns 200 if there is postgres master behind governor.
GET /slave returns 200 is there is postgres slave behind governor
In all other cases it returns 503
Currently server always listening on 0.0.0.0:8080, but it should be
configurable. In the next versions this rest api could also report some
status of etcd and could be used by is_healthiest_node method
2015-05-23 20:29:51 +02:00
Alexander Kukushkin f53c369c69 Connect timeout 5 seconds for psycopg2
Refactored query and is_healthiest_node methods
query method wont retry more then 3 times if OperationalError raised
is_healthiest_node takes into account that one of the nodes could be
still a master
2015-05-23 20:21:13 +02:00
Alexander Kukushkin 7f9c10e33f Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring 2015-05-22 12:27:02 +02:00
Alexander Kukushkin b00846affc Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	helpers/postgresql.py
2015-05-22 12:26:55 +02:00
Alexander Kukushkin 34f9b666cf Demote master when etcd is not accessible 2015-05-22 12:26:19 +02:00
Alexander Kukushkin 09163ac454 If there is no connect_address defined in yml file use address from listen as a fallback 2015-05-22 12:03:43 +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 4a4d9b85e5 Make sure that there is the new line at the end of pg_hba.con 2015-05-22 11:23:11 +02:00
Feike Steenbergen ebfa29b89b Remove "testing" code from the helpers 2015-05-21 14:58:24 +02:00
Feike Steenbergen 836a681157 Fixed the tests, by testing also found an squashed a bug in the StatusPage on python 3. 2015-05-21 14:40:07 +02:00
Alexander Kukushkin 1fb7b2cbe1 Compatibility with python3 2015-05-20 18:19:23 +02:00
Alexander Kukushkin 5d9a3d46a2 Format according to pep8 2015-05-20 18:18:45 +02:00
Oleksii Kliukin becce1dcf0 Merge branch 'master' of https://github.com/zalando/governor into s3_backups 2015-05-20 17:09:39 +02:00
Oleksii Kliukin 363b3c7122 Merge pull request #11 from CyberDem0n/master
some simple tests
2015-05-20 16:55:27 +02:00
Oleksii Kliukin 7dd1e295ca re-add the encoding parameter to initdb. 2015-05-20 16:31:26 +02:00
Alexander Kukushkin 3533b790cb Update list of success return codes for PUT and DELETE 2015-05-20 12:03:12 +02:00
Oleksii Kliukin 1c1a15908c use governor yaml parameters and not environment variables to configure backups with WAL-E. 2015-05-20 11:47:20 +02:00
Oleksii Kliukin 8a36f17d21 retry with pg_basebackup if one cannot get data from WAL-E. 2015-05-20 11:47:20 +02:00
Oleksii Kliukin 3898610ea3 Put back the S3/pg_basebackup condition after testing. 2015-05-20 11:47:20 +02:00
Oleksii Kliukin 4af752d668 revert the S3/pg_basebackup choice to unconditionally prefer S3 for testing purposes. 2015-05-20 11:47:20 +02:00
Oleksii Kliukin 2efa97334b returned the choice between S3 and pg_basebackup based on diff_in_bytes 2015-05-20 11:47:20 +02:00
Oleksii Kliukin e02eec91bf save/restore both postgresql.conf and pg_hba.conf for WAL-e backup. 2015-05-20 11:47:20 +02:00
Oleksii Kliukin 42dfaaab3f write pg_hba.conf for the replica initialized from WAL-E. Temporarily use WAL-e always as a mean to create replica for testing purposes. 2015-05-20 11:47:20 +02:00
Oleksii Kliukin 8a6a7b4cea fix a typo. 2015-05-20 11:47:20 +02:00
Oleksii Kliukin 75b30d8014 save postgresql.conf not only on initdb, but on any start of the server. 2015-05-20 11:47:19 +02:00
Oleksii Kliukin 7a2be131bd save/restore postgresql.conf for WAL-e backups, since WAL-E excludes postgresql.conf from the backup/restore. 2015-05-20 11:47:19 +02:00
Oleksii Kliukin d4b366a7e2 some arithmetics and type conversion fixes. 2015-05-20 11:46:27 +02:00
Oleksii Kliukin 594efe3b64 fix a typo. 2015-05-20 11:46:26 +02:00
Oleksii Kliukin 19a04a81da split arguments for check_output when checking for the latest backup. 2015-05-20 11:46:26 +02:00
Oleksii Kliukin 9e82c3ebd7 add functionality to fetch base backup from wal-e for the new replica creation and code to decide whether to use wal-e or pg_basebackup. 2015-05-20 11:46:26 +02:00
Alexander Kukushkin 0d5bb48ead Close connection when querying other members of cluster 2015-05-19 14:01:30 +02:00
Feike Steenbergen 24c29aee04 Add hostssl entry to pg_hba 2015-05-19 13:03:14 +02:00
Feike Steenbergen f6fc60800a Close connection when querying other members of cluster. 2015-05-18 16:54:36 +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 df855bb8de Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring 2015-05-18 14:39:39 +02:00
Alexander Kukushkin 520de12232 Remove debug print 2015-05-18 14:39:14 +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 9a1f0d1bd1 Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	helpers/postgresql.py
2015-05-18 13:38:46 +02:00