diff --git a/postgres-appliance/runit/pgqd/run b/postgres-appliance/runit/pgqd/run index 27721aa18..93c2d00e0 100755 --- a/postgres-appliance/runit/pgqd/run +++ b/postgres-appliance/runit/pgqd/run @@ -6,4 +6,4 @@ if ! $CHPST true 2> /dev/null; then fi exec 2>&1 -exec $CHPST env -i PGAPPNAME="pgq ticker" /scripts/patroni_wait.sh --role master -- /usr/bin/pgqd /home/postgres/pgq_ticker.ini +exec $CHPST env -i PGAPPNAME="pgq ticker" /scripts/patroni_wait.sh --role primary -- /usr/bin/pgqd /home/postgres/pgq_ticker.ini diff --git a/postgres-appliance/scripts/callback_aws.py b/postgres-appliance/scripts/callback_aws.py index 971ac7684..6032fbaa9 100755 --- a/postgres-appliance/scripts/callback_aws.py +++ b/postgres-appliance/scripts/callback_aws.py @@ -65,7 +65,7 @@ def main(): ec2 = boto.ec2.connect_to_region(metadata['region']) - if argc == 5 and role in ('master', 'standby_leader') and action in ('on_start', 'on_role_change'): + if argc == 5 and role in ('primary', 'standby_leader') and action in ('on_start', 'on_role_change'): associate_address(ec2, sys.argv[1], instance_id) instance = get_instance(ec2, instance_id) diff --git a/postgres-appliance/scripts/callback_role.py b/postgres-appliance/scripts/callback_role.py index 393b069ce..b0d482834 100755 --- a/postgres-appliance/scripts/callback_role.py +++ b/postgres-appliance/scripts/callback_role.py @@ -19,6 +19,7 @@ logger = logging.getLogger(__name__) LABEL = os.environ.get("KUBERNETES_ROLE_LABEL", 'spilo-role') +LEADER_LABEL_VALUE = os.environ.get("KUBERNETES_LEADER_LABEL_VALUE", 'master') def read_first_line(filename): @@ -78,7 +79,7 @@ def record_role_change(action, new_role, cluster): new_role = None if action == 'on_stop' else new_role logger.debug("Changing the pod's role to %s", new_role) pod_namespace = os.environ.get('POD_NAMESPACE', read_first_line(KUBE_NAMESPACE_FILENAME)) or 'default' - if new_role == 'master': + if new_role == LEADER_LABEL_VALUE: change_endpoints(pod_namespace, cluster) change_pod_role_label(pod_namespace, new_role) diff --git a/postgres-appliance/scripts/configure_spilo.py b/postgres-appliance/scripts/configure_spilo.py index bf947c7ed..b7a301202 100755 --- a/postgres-appliance/scripts/configure_spilo.py +++ b/postgres-appliance/scripts/configure_spilo.py @@ -379,7 +379,7 @@ def deep_update(a, b): threshold_megabytes: {{WALE_BACKUP_THRESHOLD_MEGABYTES}} threshold_backup_size_percentage: {{WALE_BACKUP_THRESHOLD_PERCENTAGE}} retries: 2 - no_master: 1 + no_leader: 1 {{/USE_WALE}} basebackup_fast_xlog: command: /scripts/basebackup.sh @@ -390,7 +390,7 @@ def deep_update(a, b): threshold_megabytes: {{WALE_BACKUP_THRESHOLD_MEGABYTES}} threshold_backup_size_percentage: {{WALE_BACKUP_THRESHOLD_PERCENTAGE}} retries: 2 - no_master: 1 + no_leader: 1 {{/STANDBY_WITH_WALE}} ''' diff --git a/postgres-appliance/scripts/on_role_change.sh b/postgres-appliance/scripts/on_role_change.sh index ad54b0cb5..270cc1b1e 100755 --- a/postgres-appliance/scripts/on_role_change.sh +++ b/postgres-appliance/scripts/on_role_change.sh @@ -7,7 +7,7 @@ shift readonly dbname=postgres -if [[ "${*: -3:1}" == "on_role_change" && "${*: -2:1}" == "master" ]]; then +if [[ "${*: -3:1}" == "on_role_change" && "${*: -2:1}" == "primary" ]]; then num=30 # wait 30 seconds for end of recovery while [[ $((num--)) -gt 0 ]]; do if [[ "$(psql -d $dbname -tAc 'SELECT pg_catalog.pg_is_in_recovery()')" == "f" ]]; then diff --git a/postgres-appliance/scripts/patroni_wait.sh b/postgres-appliance/scripts/patroni_wait.sh index 79a0be650..6edb95234 100755 --- a/postgres-appliance/scripts/patroni_wait.sh +++ b/postgres-appliance/scripts/patroni_wait.sh @@ -1,6 +1,6 @@ #!/bin/bash -ROLE=master +ROLE=primary INTERVAL=60 TIMEOUT="" @@ -17,7 +17,7 @@ Options: -t, --timeout Fail after TIMEOUT seconds (default: no timeout) -Waits for ROLE (master or replica). It will check every INTERVAL seconds ($INTERVAL). +Waits for ROLE (primary or replica). It will check every INTERVAL seconds ($INTERVAL). If TIMEOUT is specified, it will stop trying after TIMEOUT seconds. Executes COMMAND after ROLE has become available. (Default: exit 0) diff --git a/postgres-appliance/scripts/wale_restore.sh b/postgres-appliance/scripts/wale_restore.sh index 497afe30f..4fbcedd01 100755 --- a/postgres-appliance/scripts/wale_restore.sh +++ b/postgres-appliance/scripts/wale_restore.sh @@ -24,7 +24,7 @@ while getopts ":-:" optchar; do threshold_megabytes=*|threshold-megabytes=* ) THRESHOLD_MEGABYTES=${OPTARG#*=} ;; - no_master=*|no-master=* ) + no_leader=*|no-master=* ) NO_MASTER=${OPTARG#*=} ;; esac