From 9e6ca617de0fc53b39a58fc5a94e06cc2ae07032 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Wed, 11 May 2016 09:48:54 +0200 Subject: [PATCH 01/12] Add spec for the dynamic configuration. --- specs/dynamic_configuration.rst | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 specs/dynamic_configuration.rst diff --git a/specs/dynamic_configuration.rst b/specs/dynamic_configuration.rst new file mode 100644 index 00000000..4ac97666 --- /dev/null +++ b/specs/dynamic_configuration.rst @@ -0,0 +1,60 @@ +Patroni configuration reload +============================ + +Patroni configuration should be stored in the DCS. There will be 3 types of configuration: + +- default configuraton set in Patroni + That should be applied during the initialization time and written to etcd. + +- startup configuration (also in patroni.yml). + They should be applied during the initialization time. Unlike other options, they are not written in etcd and + any attempts to change them dynamically are blocked. + +- dynamic configuration. + Those options can be set in etcd at any time. If the options changed are not part of the startup configuration, + they are applied asynchronously (upon the next wake up cycle) to every node, which gets subsequently reloaded. + If the node requires a restart to apply the configuration (for options with context postmaster or internal, if + their values have changed), a special flag indiciating this should be set in the members.data JSON. A new API + endpoint should return whether the given node requires a restart. Additionally, the node status shoudl also + idincate this. + +Some options may not be increased on the master independently of the replicas (master-dependent options): + +- max_connections +- max_locks_per_transactions +- max_worker_processes +- max_prepared_transactions + +Regarding the options that can be set, the following restrictions apply: +- dynamic configuration options that are also listed in the startup configuration will not be changed, except for the case +of master-dependent options. + +When applying the startup or dynamic configuration options, the following actions should be taken: +- The node should first check if there is a postgresql.conf.patroni. +- If it exists, it contains the renamed "original" configuration. +- If it doesn't, the original postgresql.conf is taken and renamed to postgresql.conf.patroni. +- The dynamic options (with the exceptions above) are dumped into the postgresql.conf and an include is set in +postgresql.conf to postgresql.conf.patroni. Therefore, we woul be able to apply new options without re-reading the conf file +to check if the include is present not. +- If some of the options that require restart are changed (we should look at the context in pg_settings and at the actual +values of those options), a restart_pending flag of a given node should be set. This flag is reset on any restart. + +Also, the following patroni configuration options can be changed dynamically: + +- ttl +- loop_wait +- retry_timeouts (to be defined first in patroni.yaml) + +Upon changing those options, Patroni should read the relevant section of the configuration storedi in DCS and change their +run-time values. + +Patroni nodes should dump the state of the DCS options to disk on startup and upon every change of the configuration. +Only master is allowed to restore those options from the on-disk dump if those are completely absent from the DCS on invalid. + + + + + + + + From c1140ed7a885900900ca52d8210b19547722a470 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Wed, 11 May 2016 09:53:18 +0200 Subject: [PATCH 02/12] Change the default options to bootstrap --- specs/dynamic_configuration.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/specs/dynamic_configuration.rst b/specs/dynamic_configuration.rst index 4ac97666..a674a3df 100644 --- a/specs/dynamic_configuration.rst +++ b/specs/dynamic_configuration.rst @@ -3,7 +3,7 @@ Patroni configuration reload Patroni configuration should be stored in the DCS. There will be 3 types of configuration: -- default configuraton set in Patroni +- bootstrap configuraton set in Patroni That should be applied during the initialization time and written to etcd. - startup configuration (also in patroni.yml). @@ -34,8 +34,7 @@ When applying the startup or dynamic configuration options, the following action - If it exists, it contains the renamed "original" configuration. - If it doesn't, the original postgresql.conf is taken and renamed to postgresql.conf.patroni. - The dynamic options (with the exceptions above) are dumped into the postgresql.conf and an include is set in -postgresql.conf to postgresql.conf.patroni. Therefore, we woul be able to apply new options without re-reading the conf file -to check if the include is present not. +postgresql.conf to postgresql.conf.patroni. Therefore, we would be able to apply new options without re-reading the conf file to check if the include is present not. - If some of the options that require restart are changed (we should look at the context in pg_settings and at the actual values of those options), a restart_pending flag of a given node should be set. This flag is reset on any restart. @@ -49,7 +48,7 @@ Upon changing those options, Patroni should read the relevant section of the con run-time values. Patroni nodes should dump the state of the DCS options to disk on startup and upon every change of the configuration. -Only master is allowed to restore those options from the on-disk dump if those are completely absent from the DCS on invalid. +Only master is allowed to restore those options from the on-disk dump if those are completely absent from the DCS or invalid. From 688a09396d6ecb5ac4274b65bd5a4f9feff4dc4a Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Wed, 11 May 2016 09:55:39 +0200 Subject: [PATCH 03/12] Fix list formatting --- specs/dynamic_configuration.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/specs/dynamic_configuration.rst b/specs/dynamic_configuration.rst index a674a3df..253960dd 100644 --- a/specs/dynamic_configuration.rst +++ b/specs/dynamic_configuration.rst @@ -26,10 +26,12 @@ Some options may not be increased on the master independently of the replicas (m - max_prepared_transactions Regarding the options that can be set, the following restrictions apply: + - dynamic configuration options that are also listed in the startup configuration will not be changed, except for the case of master-dependent options. When applying the startup or dynamic configuration options, the following actions should be taken: + - The node should first check if there is a postgresql.conf.patroni. - If it exists, it contains the renamed "original" configuration. - If it doesn't, the original postgresql.conf is taken and renamed to postgresql.conf.patroni. From 622e110f0afca74c6c66777436a767143bd75042 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Wed, 11 May 2016 09:57:40 +0200 Subject: [PATCH 04/12] More formatting fixes --- specs/dynamic_configuration.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/specs/dynamic_configuration.rst b/specs/dynamic_configuration.rst index 253960dd..a65012ab 100644 --- a/specs/dynamic_configuration.rst +++ b/specs/dynamic_configuration.rst @@ -27,8 +27,8 @@ Some options may not be increased on the master independently of the replicas (m Regarding the options that can be set, the following restrictions apply: -- dynamic configuration options that are also listed in the startup configuration will not be changed, except for the case -of master-dependent options. +- dynamic configuration options that are also listed in the startup configuration will not be changed, + except for the case of master-dependent options. When applying the startup or dynamic configuration options, the following actions should be taken: @@ -36,9 +36,9 @@ When applying the startup or dynamic configuration options, the following action - If it exists, it contains the renamed "original" configuration. - If it doesn't, the original postgresql.conf is taken and renamed to postgresql.conf.patroni. - The dynamic options (with the exceptions above) are dumped into the postgresql.conf and an include is set in -postgresql.conf to postgresql.conf.patroni. Therefore, we would be able to apply new options without re-reading the conf file to check if the include is present not. + postgresql.conf to postgresql.conf.patroni. Therefore, we would be able to apply new options without re-reading the configuration file to check if the include is present not. - If some of the options that require restart are changed (we should look at the context in pg_settings and at the actual -values of those options), a restart_pending flag of a given node should be set. This flag is reset on any restart. + values of those options), a restart_pending flag of a given node should be set. This flag is reset on any restart. Also, the following patroni configuration options can be changed dynamically: From c3317f748e1562f7d7029f7f2075605681d659a5 Mon Sep 17 00:00:00 2001 From: Feike Steenbergen Date: Fri, 13 May 2016 09:17:23 +0200 Subject: [PATCH 05/12] Spelling only --- specs/dynamic_configuration.rst | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/specs/dynamic_configuration.rst b/specs/dynamic_configuration.rst index a65012ab..6bdd714b 100644 --- a/specs/dynamic_configuration.rst +++ b/specs/dynamic_configuration.rst @@ -3,7 +3,7 @@ Patroni configuration reload Patroni configuration should be stored in the DCS. There will be 3 types of configuration: -- bootstrap configuraton set in Patroni +- bootstrap configuration set in Patroni That should be applied during the initialization time and written to etcd. - startup configuration (also in patroni.yml). @@ -14,9 +14,9 @@ Patroni configuration should be stored in the DCS. There will be 3 types of conf Those options can be set in etcd at any time. If the options changed are not part of the startup configuration, they are applied asynchronously (upon the next wake up cycle) to every node, which gets subsequently reloaded. If the node requires a restart to apply the configuration (for options with context postmaster or internal, if - their values have changed), a special flag indiciating this should be set in the members.data JSON. A new API - endpoint should return whether the given node requires a restart. Additionally, the node status shoudl also - idincate this. + their values have changed), a special flag indicating this should be set in the members.data JSON. A new API + endpoint should return whether the given node requires a restart. Additionally, the node status should also + indicate this. Some options may not be increased on the master independently of the replicas (master-dependent options): @@ -46,16 +46,9 @@ Also, the following patroni configuration options can be changed dynamically: - loop_wait - retry_timeouts (to be defined first in patroni.yaml) -Upon changing those options, Patroni should read the relevant section of the configuration storedi in DCS and change their +Upon changing those options, Patroni should read the relevant section of the configuration stored in DCS and change their run-time values. Patroni nodes should dump the state of the DCS options to disk on startup and upon every change of the configuration. Only master is allowed to restore those options from the on-disk dump if those are completely absent from the DCS or invalid. - - - - - - - From 7ed2052707a15ca4a7cd225b1a8a479e9c804a60 Mon Sep 17 00:00:00 2001 From: Feike Steenbergen Date: Fri, 13 May 2016 12:30:12 +0200 Subject: [PATCH 06/12] Document passing on of run-time parameters --- specs/dynamic_configuration.rst | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/specs/dynamic_configuration.rst b/specs/dynamic_configuration.rst index 6bdd714b..ffcf299f 100644 --- a/specs/dynamic_configuration.rst +++ b/specs/dynamic_configuration.rst @@ -32,14 +32,27 @@ Regarding the options that can be set, the following restrictions apply: When applying the startup or dynamic configuration options, the following actions should be taken: -- The node should first check if there is a postgresql.conf.patroni. +- The node should first check if there is a postgresql.base.conf. - If it exists, it contains the renamed "original" configuration. -- If it doesn't, the original postgresql.conf is taken and renamed to postgresql.conf.patroni. +- If it doesn't, the original postgresql.conf is taken and renamed to postgresql.base.conf. - The dynamic options (with the exceptions above) are dumped into the postgresql.conf and an include is set in - postgresql.conf to postgresql.conf.patroni. Therefore, we would be able to apply new options without re-reading the configuration file to check if the include is present not. + postgresql.conf to postgresql.base.conf. Therefore, we would be able to apply new options without re-reading the configuration file to check if the include is present not. +- Some parameters that are essential for Patroni to manage the cluster are overridden using the command line, these + include at least `port`, `listen_addresses`, `wal_level` - If some of the options that require restart are changed (we should look at the context in pg_settings and at the actual values of those options), a restart_pending flag of a given node should be set. This flag is reset on any restart. +Parameters would be applied in the following order (run-time are given the highest priority): + +1. load parameters from file `postgresql.base.conf` +2. load parameters from file `postgresql.conf` +3. load parameters from file `postgresql.auto.conf` +4. run-time parameter using `-o --name=value` + +This allows configuration for all the nodes (2), configuration for a specific node using `ALTER SYSTEM` (3) and ensures that +parameters essential to the running of Patroni are enforced. (4) + + Also, the following patroni configuration options can be changed dynamically: - ttl From 9323cbd5d6598f2170d8fbed8ef3ef0f18d1f8ba Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 13 May 2016 16:53:20 +0200 Subject: [PATCH 07/12] Add proposal of a new structure of config.yml --- specs/patroni_bootstrap.yml | 121 ++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 specs/patroni_bootstrap.yml diff --git a/specs/patroni_bootstrap.yml b/specs/patroni_bootstrap.yml new file mode 100644 index 00000000..0abc484d --- /dev/null +++ b/specs/patroni_bootstrap.yml @@ -0,0 +1,121 @@ +### To be discussed +scope: &scope batman +restapi: + listen: 127.0.0.1:8008 + connect_address: 127.0.0.1:8008 +# auth: 'username:password' +# certfile: /etc/ssl/certs/ssl-cert-snakeoil.pem +# keyfile: /etc/ssl/private/ssl-cert-snakeoil.key +bootstrap: + ttl: &ttl 30 + loop_wait: &loop_wait 10 + initdb: ## We allow the following options to be passed on to initdb + # - auth: authmethod + # - auth-host: authmethod + # - auth-local: authmethod + - encoding: UTF8 + # - data-checksums # When pg_rewind is needed on 9.3, this needs to be enabled + # - locale: locale + # - lc-collate: locale + # - lc-ctype: locale + # - lc-messages: locale + # - lc-monetary: locale + # - lc-numeric: locale + # - lc-time: locale + # - text-search-config: CFG + # - xlogdir: directory + # - debug + # - noclean + pg_hba: + - host replication replicator 127.0.0.1/32 md5 + - host all all 0.0.0.0/0 md5 + # - hostssl all all 0.0.0.0/0 md5 + replication: + username: replicator + password: rep-pass + superuser: + username: postgres + password: zalando + admin: + username: admin + password: admin + postgresql: + archive_mode: "on" + wal_level: hot_standby + max_wal_senders: 10 + wal_keep_segments: 8 + archive_timeout: 1800s + max_replication_slots: 10 + hot_standby: "on" + wal_log_hints: "on" + create_replica_method: + - basebackup +# - wal_e +# commented-out example for wal-e provisioning + #wal_e: + #command: /patroni/scripts/wale_restore.py + #env_dir: /etc/wal-e.d/env + #threshold_megabytes: 10240 + #threshold_backup_size_percentage: 30 + #retries: 2 + #use_iam: 1 + #recovery_conf: + #restore_command: envdir /etc/wal-e.d/env wal-e wal-fetch "%f" "%p" -p 1 + recovery_conf: + restore_command: cp ../wal_archive/%f %p +etcd: + scope: *scope + ttl: *ttl + host: 127.0.0.1:4001 + #discovery_srv: my-etcd.domain +#consul: +# scope: *scope +# ttl: *ttl +# host: 127.0.0.1:8500 +#zookeeper: +# scope: *scope +# session_timeout: *ttl +# reconnect_timeout: *loop_wait +# hosts: +# - 127.0.0.1:2181 +# - 127.0.0.2:2181 +# exhibitor: +# poll_interval: 300 +# port: 8181 +# hosts: +# - host1 +# - host2 +# - host3 +postgresql: + name: postgresql0 + scope: *scope + listen: 127.0.0.1:5432 + connect_address: 127.0.0.1:5432 + data_dir: data/postgresql0 + use_slots: True + pgpass: /tmp/pgpass0 + pg_rewind: + username: postgres + password: zalando + create_replica_method: + - basebackup +# - wal_e +# commented-out example for wal-e provisioning + #wal_e: + #command: /patroni/scripts/wale_restore.py + #env_dir: /etc/wal-e.d/env + #threshold_megabytes: 10240 + #threshold_backup_size_percentage: 30 + #retries: 2 + #use_iam: 1 + #recovery_conf: + #restore_command: envdir /etc/wal-e.d/env wal-e wal-fetch "%f" "%p" -p 1 + recovery_conf: + restore_command: cp ../wal_archive/%f %p + parameters: + archive_command: mkdir -p ../wal_archive && test ! -f ../wal_archive/%f && cp %p ../wal_archive/%f + unix_socket_directories: '.' +tags: + nofailover: False + noloadbalance: False + clonefrom: False From a841cfeec37e5ddab4d649adc9571b63accc2ef2 Mon Sep 17 00:00:00 2001 From: Feike Steenbergen Date: Wed, 18 May 2016 11:20:25 +0200 Subject: [PATCH 08/12] Further restructuring of patroni.yml --- specs/patroni_bootstrap.yml | 38 ++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/specs/patroni_bootstrap.yml b/specs/patroni_bootstrap.yml index 0abc484d..6348649a 100644 --- a/specs/patroni_bootstrap.yml +++ b/specs/patroni_bootstrap.yml @@ -30,15 +30,24 @@ bootstrap: - host replication replicator 127.0.0.1/32 md5 - host all all 0.0.0.0/0 md5 # - hostssl all all 0.0.0.0/0 md5 - replication: - username: replicator - password: rep-pass - superuser: - username: postgres - password: zalando - admin: - username: admin - password: admin + users: + admin: + password: admin + options: + - createrole + - createdatabase + &replication_username replicator + password: &replication_password replicada + options: + - replication + &superuser_username postgres: + password: &superuser_password zalando + options: + - superuser + pg_rewind: + enabled: true + username: &superuser_username + password: &superuser_password postgresql: archive_mode: "on" wal_level: hot_standby @@ -88,15 +97,18 @@ etcd: # - host3 postgresql: name: postgresql0 - scope: *scope listen: 127.0.0.1:5432 connect_address: 127.0.0.1:5432 data_dir: data/postgresql0 use_slots: True pgpass: /tmp/pgpass0 - pg_rewind: - username: postgres - password: zalando + authentication: + replication: + username: *replication_username + password: *replication_password + superuser: + username: *superuser_username + password: *superuser_password create_replica_method: - basebackup # - wal_e From 3ff7850dae5937515f47cb3f9b46924a5fae5590 Mon Sep 17 00:00:00 2001 From: Feike Steenbergen Date: Wed, 18 May 2016 12:51:05 +0200 Subject: [PATCH 09/12] Shuffle configuration items --- specs/patroni_bootstrap.yml | 107 ++++++++++++------------------------ 1 file changed, 35 insertions(+), 72 deletions(-) diff --git a/specs/patroni_bootstrap.yml b/specs/patroni_bootstrap.yml index 6348649a..c56f51f8 100644 --- a/specs/patroni_bootstrap.yml +++ b/specs/patroni_bootstrap.yml @@ -1,31 +1,38 @@ ### To be discussed scope: &scope batman +namespace: /service/ restapi: listen: 127.0.0.1:8008 connect_address: 127.0.0.1:8008 # auth: 'username:password' # certfile: /etc/ssl/certs/ssl-cert-snakeoil.pem # keyfile: /etc/ssl/private/ssl-cert-snakeoil.key + +## The bootstrap section is only evaluated once, when a new PostgreSQL +## cluster needs to be initialized. bootstrap: - ttl: &ttl 30 - loop_wait: &loop_wait 10 - initdb: ## We allow the following options to be passed on to initdb - # - auth: authmethod - # - auth-host: authmethod - # - auth-local: authmethod + dcs: + ttl: &ttl 30 + loop_wait: &loop_wait 10 + use_pg_rewind: true + use_slots: True + postgresql: + # recovery_conf: + # restore_command: cp ../wal_archive/%f %p + parameters: + # archive_mode: "on" + # archive_command: mkdir -p ../wal_archive && test ! -f ../wal_archive/%f && cp %p ../wal_archive/%f + wal_level: hot_standby + max_wal_senders: 10 + wal_keep_segments: 8 + archive_timeout: 1800s + max_replication_slots: 10 + hot_standby: "on" + wal_log_hints: "on" + initdb: ## Note: It needs to be a list (some options need values, others are switches) - encoding: UTF8 - # - data-checksums # When pg_rewind is needed on 9.3, this needs to be enabled - # - locale: locale - # - lc-collate: locale - # - lc-ctype: locale - # - lc-messages: locale - # - lc-monetary: locale - # - lc-numeric: locale - # - lc-time: locale - # - text-search-config: CFG - # - xlogdir: directory - # - debug - # - noclean + - data-checksums + - auth-local: peer pg_hba: - host replication replicator 127.0.0.1/32 md5 - host all all 0.0.0.0/0 md5 @@ -44,47 +51,12 @@ bootstrap: password: &superuser_password zalando options: - superuser - pg_rewind: - enabled: true - username: &superuser_username - password: &superuser_password - postgresql: - archive_mode: "on" - wal_level: hot_standby - max_wal_senders: 10 - wal_keep_segments: 8 - archive_timeout: 1800s - max_replication_slots: 10 - hot_standby: "on" - wal_log_hints: "on" - create_replica_method: - - basebackup -# - wal_e -# commented-out example for wal-e provisioning - #wal_e: - #command: /patroni/scripts/wale_restore.py - #env_dir: /etc/wal-e.d/env - #threshold_megabytes: 10240 - #threshold_backup_size_percentage: 30 - #retries: 2 - #use_iam: 1 - #recovery_conf: - #restore_command: envdir /etc/wal-e.d/env wal-e wal-fetch "%f" "%p" -p 1 - recovery_conf: - restore_command: cp ../wal_archive/%f %p etcd: - scope: *scope - ttl: *ttl host: 127.0.0.1:4001 #discovery_srv: my-etcd.domain #consul: -# scope: *scope -# ttl: *ttl # host: 127.0.0.1:8500 #zookeeper: -# scope: *scope -# session_timeout: *ttl -# reconnect_timeout: *loop_wait # hosts: # - 127.0.0.1:2181 # - 127.0.0.2:2181 @@ -97,10 +69,9 @@ etcd: # - host3 postgresql: name: postgresql0 - listen: 127.0.0.1:5432 connect_address: 127.0.0.1:5432 + listen: 127.0.0.1:5432 data_dir: data/postgresql0 - use_slots: True pgpass: /tmp/pgpass0 authentication: replication: @@ -109,24 +80,16 @@ postgresql: superuser: username: *superuser_username password: *superuser_password - create_replica_method: - - basebackup -# - wal_e -# commented-out example for wal-e provisioning - #wal_e: - #command: /patroni/scripts/wale_restore.py - #env_dir: /etc/wal-e.d/env - #threshold_megabytes: 10240 - #threshold_backup_size_percentage: 30 - #retries: 2 - #use_iam: 1 - #recovery_conf: - #restore_command: envdir /etc/wal-e.d/env wal-e wal-fetch "%f" "%p" -p 1 - recovery_conf: - restore_command: cp ../wal_archive/%f %p + ## You can override node specific PostgreSQL parameters here + ## from 9.4 on it may be better to use ALTER SYSTEM + ## + ## Some parameters are essential for Patroni to operate, these parameters will be ignored: + ## - listen_addresses + ## - port + ## - wal_level (if lower than hot_standby) + ## - min_wal_senders = 0 parameters: - archive_command: mkdir -p ../wal_archive && test ! -f ../wal_archive/%f && cp %p ../wal_archive/%f - unix_socket_directories: '.' + # work_mem: 1GB tags: nofailover: False noloadbalance: False From 539a23041e0365d6a62bf0e51830427f54539a7b Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Tue, 24 May 2016 14:48:00 +0200 Subject: [PATCH 10/12] Move some parameters around, add new special ones - name is moved to globals, maximum_lag_on_failover to the bootstrap - add new parameters that cannot be changed (or those the values of which cannot be lower than default) into the postgresql parameters section. --- specs/patroni_bootstrap.yml | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/specs/patroni_bootstrap.yml b/specs/patroni_bootstrap.yml index c56f51f8..a6b4510a 100644 --- a/specs/patroni_bootstrap.yml +++ b/specs/patroni_bootstrap.yml @@ -1,6 +1,8 @@ ### To be discussed scope: &scope batman namespace: /service/ +name: postgresql0 + restapi: listen: 127.0.0.1:8008 connect_address: 127.0.0.1:8008 @@ -12,13 +14,14 @@ restapi: ## cluster needs to be initialized. bootstrap: dcs: - ttl: &ttl 30 - loop_wait: &loop_wait 10 - use_pg_rewind: true - use_slots: True + ttl: 30 + loop_wait: 10 + maximum_lag_on_failover: 1048576 postgresql: # recovery_conf: # restore_command: cp ../wal_archive/%f %p + use_pg_rewind: true + #use_slots: True parameters: # archive_mode: "on" # archive_command: mkdir -p ../wal_archive && test ! -f ../wal_archive/%f && cp %p ../wal_archive/%f @@ -43,14 +46,6 @@ bootstrap: options: - createrole - createdatabase - &replication_username replicator - password: &replication_password replicada - options: - - replication - &superuser_username postgres: - password: &superuser_password zalando - options: - - superuser etcd: host: 127.0.0.1:4001 #discovery_srv: my-etcd.domain @@ -68,27 +63,32 @@ etcd: # - host2 # - host3 postgresql: - name: postgresql0 connect_address: 127.0.0.1:5432 listen: 127.0.0.1:5432 data_dir: data/postgresql0 pgpass: /tmp/pgpass0 authentication: replication: - username: *replication_username - password: *replication_password + username: replicator + password: rep-pass superuser: - username: *superuser_username - password: *superuser_password + username: postgres + password: zalando + parameters: ## You can override node specific PostgreSQL parameters here ## from 9.4 on it may be better to use ALTER SYSTEM ## - ## Some parameters are essential for Patroni to operate, these parameters will be ignored: + ## Some parameters are essential for Patroni to operate, these parameters will be ignored when changed with ALTER SYSTEM + ## They should be changed only in this file ## - listen_addresses ## - port - ## - wal_level (if lower than hot_standby) - ## - min_wal_senders = 0 - parameters: + ## The following parameters cannot be lower than the values below + ## - hot_standby = 'on' + ## - wal_level = 'hot_standby' + ## - max_wal_senders = 5 + ## - max_replication_slots = 5 ## 9.4+ + ## - wal_log_hints = 'on' ## 9.4+ + ## # work_mem: 1GB tags: nofailover: False From d2b701c001bd764333953c2ba789f45bfc5625e5 Mon Sep 17 00:00:00 2001 From: Feike Steenbergen Date: Thu, 9 Jun 2016 15:30:22 +0200 Subject: [PATCH 11/12] Remove obsolete configuration example --- specs/patroni_bootstrap.yml | 96 ------------------------------------- 1 file changed, 96 deletions(-) delete mode 100644 specs/patroni_bootstrap.yml diff --git a/specs/patroni_bootstrap.yml b/specs/patroni_bootstrap.yml deleted file mode 100644 index c56f51f8..00000000 --- a/specs/patroni_bootstrap.yml +++ /dev/null @@ -1,96 +0,0 @@ -### To be discussed -scope: &scope batman -namespace: /service/ -restapi: - listen: 127.0.0.1:8008 - connect_address: 127.0.0.1:8008 -# auth: 'username:password' -# certfile: /etc/ssl/certs/ssl-cert-snakeoil.pem -# keyfile: /etc/ssl/private/ssl-cert-snakeoil.key - -## The bootstrap section is only evaluated once, when a new PostgreSQL -## cluster needs to be initialized. -bootstrap: - dcs: - ttl: &ttl 30 - loop_wait: &loop_wait 10 - use_pg_rewind: true - use_slots: True - postgresql: - # recovery_conf: - # restore_command: cp ../wal_archive/%f %p - parameters: - # archive_mode: "on" - # archive_command: mkdir -p ../wal_archive && test ! -f ../wal_archive/%f && cp %p ../wal_archive/%f - wal_level: hot_standby - max_wal_senders: 10 - wal_keep_segments: 8 - archive_timeout: 1800s - max_replication_slots: 10 - hot_standby: "on" - wal_log_hints: "on" - initdb: ## Note: It needs to be a list (some options need values, others are switches) - - encoding: UTF8 - - data-checksums - - auth-local: peer - pg_hba: - - host replication replicator 127.0.0.1/32 md5 - - host all all 0.0.0.0/0 md5 - # - hostssl all all 0.0.0.0/0 md5 - users: - admin: - password: admin - options: - - createrole - - createdatabase - &replication_username replicator - password: &replication_password replicada - options: - - replication - &superuser_username postgres: - password: &superuser_password zalando - options: - - superuser -etcd: - host: 127.0.0.1:4001 - #discovery_srv: my-etcd.domain -#consul: -# host: 127.0.0.1:8500 -#zookeeper: -# hosts: -# - 127.0.0.1:2181 -# - 127.0.0.2:2181 -# exhibitor: -# poll_interval: 300 -# port: 8181 -# hosts: -# - host1 -# - host2 -# - host3 -postgresql: - name: postgresql0 - connect_address: 127.0.0.1:5432 - listen: 127.0.0.1:5432 - data_dir: data/postgresql0 - pgpass: /tmp/pgpass0 - authentication: - replication: - username: *replication_username - password: *replication_password - superuser: - username: *superuser_username - password: *superuser_password - ## You can override node specific PostgreSQL parameters here - ## from 9.4 on it may be better to use ALTER SYSTEM - ## - ## Some parameters are essential for Patroni to operate, these parameters will be ignored: - ## - listen_addresses - ## - port - ## - wal_level (if lower than hot_standby) - ## - min_wal_senders = 0 - parameters: - # work_mem: 1GB -tags: - nofailover: False - noloadbalance: False - clonefrom: False From 4ba19d52079fd1cef05215b3065cbd8b193c48ce Mon Sep 17 00:00:00 2001 From: Feike Steenbergen Date: Thu, 9 Jun 2016 15:32:37 +0200 Subject: [PATCH 12/12] Move documentation into docs directory --- {specs => docs}/dynamic_configuration.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {specs => docs}/dynamic_configuration.rst (100%) diff --git a/specs/dynamic_configuration.rst b/docs/dynamic_configuration.rst similarity index 100% rename from specs/dynamic_configuration.rst rename to docs/dynamic_configuration.rst