Commit Graph
58 Commits
Author SHA1 Message Date
Alexander Kukushkin 1531304baa return result of last_operation as a string 2015-07-07 12:23:06 +02:00
Alexander Kukushkin 9732106e5d BUGFIX: keep list of replication slots on slaves empty
Otherwise slaves accumulate wal files...
2015-06-25 14:01:06 +02:00
Alexander Kukushkin b7c73fdba8 Rename hostname to name in a Member 2015-06-23 14:07:00 +02:00
Alexander Kukushkin d9fbbf3ae9 Make pg_hba section more compact 2015-06-02 12:37:26 +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 bacd05d99e Determine preferable local address to connect through.
If listen contains '*' or 0.0.0.0 - connect via localhost
In all other cases pick the first one.
2015-06-01 17:00:15 +02:00
Alexander Kukushkin efccd777b2 rename pid_path to postmaster_pid 2015-06-01 16:47:56 +02:00
Alexander Kukushkin 1bcc2b5fa6 Extend postgres?.yml with pg_hba section to give possibility to customize pg_hba.conf 2015-06-01 16:05:35 +02:00
Alexander Kukushkin adcc7ac256 Try to avoid "double" promotion.
Also check presence of trigger_file on master after promotion when
pg_is_in_recovery() = false and if it is there - remove it.
Plus check presence of trigger_file on a new slave (after running
pg_basebackup) and if it is there - also remove it.
2015-06-01 13:48:44 +02:00
Alexander Kukushkin 939254021e Code cleanup: do not modify os.environ but pass copy of it to subprocess.call 2015-06-01 11:03:06 +02:00
Alexander Kukushkin b85262637d Bugfix: do not create replication slot for master 2015-06-01 09:20:24 +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 56a9f52a15 Replace os.system with subprocess.call 2015-05-27 11:16:16 +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 ce267d9f1e query method will retry only in case of communication error 2015-05-24 09:01:23 +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 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 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 0d5bb48ead Close connection when querying other members of cluster 2015-05-19 14:01:30 +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 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 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 d25ad17c32 Add support of python3 2015-05-13 14:53:23 +02:00
Christopher Winslett 2c69074652 move stale protection from is_healthy to is_healthiest to allow stale secondaries to rejoin cluster 2015-05-12 18:29:54 -07:00
Christopher Winslett 557bad37cd ensure a stale Postgres does not become leader 2015-05-12 18:11:12 -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 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
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 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 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 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