Commit Graph
122 Commits
Author SHA1 Message Date
Alexander Kukushkin cd5e589620 Revert previous commit (restore sigchld_handler) 2015-05-28 13:04:21 +02:00
Alexander Kukushkin f76f77e964 Ignore SIGCHLD instead of processing it.
This way time.sleep wont be interrupted when some external process is
finished and terminated childs would be reaped automatically.
2015-05-28 12:25:49 +02:00
Alexander Kukushkin 01e3beff1c Merge pull request #2 from CyberDem0n/restapi
Restapi
2015-05-27 18:31:42 +02:00
Alexander Kukushkin bdc4374ae3 connect address for rest api could be different from listen address 2015-05-27 14:51:41 +02:00
Alexander Kukushkin 5a817fad0d Store in etcd endpoint of restapi
In order to have backward compatibility connection url of restapi is
passed as application_name parameter in connection url of database.
Value in etcd will look like:
postgres://user:passwd@host:5432/postgres?application_name=http://host:8080/governor
Sure, this is a hack, but I guess it worth it.
2015-05-27 14:46:35 +02:00
Alexander Kukushkin 77911144c7 Improve test of governor against real config files 2015-05-27 14:44:52 +02:00
Alexander Kukushkin 56a9f52a15 Replace os.system with subprocess.call 2015-05-27 11:16:16 +02:00
Alexander Kukushkin 9968a66048 helpers/postgresql.py
Replace os.system with subprocess.call
2015-05-27 11:08:06 +02:00
Alexander Kukushkin 56daec0d6c Api: Bugfix for current_xlog_location in slaves. 2015-05-26 15:53:57 +02:00
Alexander Kukushkin 8cc0aa90b1 Fix typos when passing connection parameters to psycopg2. 2015-05-26 10:39:16 +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 45c4ba85b4 port for http servert must be integer 2015-05-26 09:17:58 +02:00
Alexander Kukushkin cca5bdef8f Configure listen address for restapi via a yaml file 2015-05-26 09:07:39 +02:00
Alexander Kukushkin 3e3acc3d3a Do not start listening port during test 2015-05-26 08:59:42 +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 755f54f266 Improve test coverage for governor.py 2015-05-24 15:42:41 +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 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 096e6e4556 Eventually member will expire in etcd 2015-05-22 11:55:20 +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
Alexander Kukushkin 3533b790cb Update list of success return codes for PUT and DELETE 2015-05-20 12:03:12 +02:00
Alexander Kukushkin 8378315b6d Remove unneeded stuff from setup.py 2015-05-19 14:14:52 +02:00
Alexander Kukushkin 0d5bb48ead Close connection when querying other members of cluster 2015-05-19 14:01:30 +02:00
Alexander Kukushkin 8946b28c51 Merge pull request #1 from CyberDem0n/testing
some simple tests
2015-05-19 13:55:38 +02:00
Alexander Kukushkin 16974ad752 do not test against 2.6 2015-05-19 13:32:35 +02:00
Alexander Kukushkin c8ee7b1c6d test against 2.6 and 3.3 2015-05-19 13:05:31 +02:00
Alexander Kukushkin 004cbf16c6 Merge branch 'master' of github.com:CyberDem0n/governor into testing 2015-05-19 13:01:15 +02:00
Alexander Kukushkin 805b3a04fc trigger rebuild 2015-05-19 12:59:37 +02:00
Alexander Kukushkin ebb8bce0f6 some simple tests 2015-05-19 12:49:53 +02:00
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