mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-09-01 00:59:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
422047f105 | ||
|
|
b85f155dbe | ||
|
|
1669a49b2d | ||
|
|
8ac8ed6584 |
@@ -45,6 +45,8 @@ def install_packages(what):
|
|||||||
packages['exhibitor'] = packages['zookeeper']
|
packages['exhibitor'] = packages['zookeeper']
|
||||||
packages = packages.get(what, [])
|
packages = packages.get(what, [])
|
||||||
ver = versions.get(what)
|
ver = versions.get(what)
|
||||||
|
if float(ver) >= 15:
|
||||||
|
packages += ['postgresql-{0}-citus-11.2'.format(ver)]
|
||||||
subprocess.call(['sudo', 'apt-get', 'update', '-y'])
|
subprocess.call(['sudo', 'apt-get', 'update', '-y'])
|
||||||
return subprocess.call(['sudo', 'apt-get', 'install', '-y', 'postgresql-' + ver, 'expect-dev'] + packages)
|
return subprocess.call(['sudo', 'apt-get', 'install', '-y', 'postgresql-' + ver, 'expect-dev'] + packages)
|
||||||
|
|
||||||
|
|||||||
@@ -110,12 +110,14 @@ jobs:
|
|||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- uses: nolar/setup-k3d-k3s@v1
|
- uses: nolar/setup-k3d-k3s@v1
|
||||||
if: matrix.dcs == 'kubernetes'
|
if: matrix.dcs == 'kubernetes'
|
||||||
- name: Add postgresql apt repo
|
- name: Add postgresql and citus apt repo
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y wget ca-certificates gnupg
|
sudo apt-get install -y wget ca-certificates gnupg debian-archive-keyring apt-transport-https
|
||||||
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||||
sudo sh -c 'wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg'
|
sudo sh -c 'wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg'
|
||||||
|
sudo sh -c 'echo "deb [signed-by=/etc/apt/trusted.gpg.d/citusdata_community.gpg] https://repos.citusdata.com/community/ubuntu/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/citusdata_community.list'
|
||||||
|
sudo sh -c 'wget -qO - https://repos.citusdata.com/community/gpgkey | gpg --dearmor > /etc/apt/trusted.gpg.d/citusdata_community.gpg'
|
||||||
if: matrix.os == 'ubuntu'
|
if: matrix.os == 'ubuntu'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: python .github/workflows/install_deps.py
|
run: python .github/workflows/install_deps.py
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ RUN set -ex \
|
|||||||
python3-etcd python3-kazoo python3-pip busybox \
|
python3-etcd python3-kazoo python3-pip busybox \
|
||||||
net-tools iputils-ping --fix-missing \
|
net-tools iputils-ping --fix-missing \
|
||||||
&& curl https://install.citusdata.com/community/deb.sh | bash \
|
&& curl https://install.citusdata.com/community/deb.sh | bash \
|
||||||
&& apt-get -y install postgresql-$PG_MAJOR-citus-11.1 \
|
&& apt-get -y install postgresql-$PG_MAJOR-citus-11.2 \
|
||||||
&& pip3 install dumb-init \
|
&& pip3 install dumb-init \
|
||||||
\
|
\
|
||||||
# Cleanup all locales but en_US.UTF-8
|
# Cleanup all locales but en_US.UTF-8
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ We call Patroni a "template" because it is far from being a one-size-fits-all or
|
|||||||
|
|
||||||
Currently supported PostgreSQL versions: 9.3 to 15.
|
Currently supported PostgreSQL versions: 9.3 to 15.
|
||||||
|
|
||||||
**Note to Citus users**: Starting from 3.0 Patroni nicely integrates with `Citus <https://www.citusdata.com>`__. Please check `Citus support <https://github.com/zalando/patroni/blob/master/docs/citus.rst>`__ page for more information.
|
**Note to Citus users**: Starting from 3.0 Patroni nicely integrates with the `Citus <https://github.com/citusdata/citus>`__ database extension to Postgres. Please check the `Citus support page <https://github.com/zalando/patroni/blob/master/docs/citus.rst>`__ in the Patroni documentation for more info about how to use Patroni high availability together with a Citus distributed cluster.
|
||||||
|
|
||||||
**Note to Kubernetes users**: Patroni can run natively on top of Kubernetes. Take a look at the `Kubernetes <https://github.com/zalando/patroni/blob/master/docs/kubernetes.rst>`__ chapter of the Patroni documentation.
|
**Note to Kubernetes users**: Patroni can run natively on top of Kubernetes. Take a look at the `Kubernetes <https://github.com/zalando/patroni/blob/master/docs/kubernetes.rst>`__ chapter of the Patroni documentation.
|
||||||
|
|
||||||
|
|||||||
+8
-5
@@ -12,9 +12,10 @@ TL;DR
|
|||||||
|
|
||||||
There are only a few simple rules you need to follow:
|
There are only a few simple rules you need to follow:
|
||||||
|
|
||||||
1. Citus extension must be available on all nodes. Absolute minimum supported
|
1. `Citus <https://github.com/citusdata/citus>`__ database extension to
|
||||||
Citus version is 10.0, but, to take all benefits from transparent
|
PostgreSQL must be available on all nodes. Absolute minimum supported Citus
|
||||||
switchovers and restarts of workers we recommend using at least Citus 11.2.
|
version is 10.0, but, to take all benefits from transparent switchovers and
|
||||||
|
restarts of workers we recommend using at least Citus 11.2.
|
||||||
2. Cluster name (``scope``) must be the same for all Citus nodes!
|
2. Cluster name (``scope``) must be the same for all Citus nodes!
|
||||||
3. Superuser credentials must be the same on coordinator and all worker
|
3. Superuser credentials must be the same on coordinator and all worker
|
||||||
nodes, and ``pg_hba.conf`` should allow superuser access between all nodes.
|
nodes, and ``pg_hba.conf`` should allow superuser access between all nodes.
|
||||||
@@ -51,8 +52,10 @@ patronictl
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
Coordinator and worker clusters are physically different PostgreSQL/Patroni
|
Coordinator and worker clusters are physically different PostgreSQL/Patroni
|
||||||
clusters that are just logically groupped together using Citus. Therefore in
|
clusters that are just logically groupped together using the
|
||||||
most cases it is not possible to manage them as a single entity.
|
`Citus <https://github.com/citusdata/citus>`__ database extension to
|
||||||
|
PostgreSQL. Therefore in most cases it is not possible to manage them as a
|
||||||
|
single entity.
|
||||||
|
|
||||||
It results in two major differences in ``patronictl`` behaviour when
|
It results in two major differences in ``patronictl`` behaviour when
|
||||||
``patroni.yaml`` has the ``citus`` section comparing with the usual:
|
``patroni.yaml`` has the ``citus`` section comparing with the usual:
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ We call Patroni a "template" because it is far from being a one-size-fits-all or
|
|||||||
|
|
||||||
Currently supported PostgreSQL versions: 9.3 to 15.
|
Currently supported PostgreSQL versions: 9.3 to 15.
|
||||||
|
|
||||||
**Note to Citus users**: Starting from 3.0 Patroni nicely integrates with `Citus <https://www.citusdata.com>`__. Please check :ref:`Citus support <citus>` page for more information.
|
**Note to Citus users**: Starting from 3.0 Patroni nicely integrates with the `Citus <https://github.com/citusdata/citus>`__ database extension to Postgres. Please check the :ref:`Citus support page <citus>` in the Patroni documentation for more info about how to use Patroni high availability together with a Citus distributed cluster.
|
||||||
|
|
||||||
**Note to Kubernetes users**: Patroni can run natively on top of Kubernetes. Take a look at the :ref:`Kubernetes <kubernetes>` chapter of the Patroni documentation.
|
**Note to Kubernetes users**: Patroni can run natively on top of Kubernetes. Take a look at the :ref:`Kubernetes <kubernetes>` chapter of the Patroni documentation.
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,16 @@
|
|||||||
Release notes
|
Release notes
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
Version 3.0.1
|
||||||
|
-------------
|
||||||
|
|
||||||
|
**Bugfixes**
|
||||||
|
|
||||||
|
- Pass proper role name to an ``on_role_change`` callback script'. (Alexander Kukushkin, Polina Bungina)
|
||||||
|
|
||||||
|
Patroni used to erroneously pass ``promoted`` role to an ``on_role_change`` callback script on promotion. The passed role name changed back to ``master``. This regression was introduced in 3.0.0.
|
||||||
|
|
||||||
|
|
||||||
Version 3.0.0
|
Version 3.0.0
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ Feature: basic replication
|
|||||||
Then I receive a response returncode 0
|
Then I receive a response returncode 0
|
||||||
And postgres2 role is the primary after 24 seconds
|
And postgres2 role is the primary after 24 seconds
|
||||||
And Response on GET http://127.0.0.1:8010/history contains recovery after 10 seconds
|
And Response on GET http://127.0.0.1:8010/history contains recovery after 10 seconds
|
||||||
|
And there is a postgres2_cb.log with "on_role_change master batman" in postgres2 data directory
|
||||||
When I issue a PATCH request to http://127.0.0.1:8010/config with {"synchronous_mode": null, "master_start_timeout": 0}
|
When I issue a PATCH request to http://127.0.0.1:8010/config with {"synchronous_mode": null, "master_start_timeout": 0}
|
||||||
Then I receive a response code 200
|
Then I receive a response code 200
|
||||||
When I add the table bar to postgres2
|
When I add the table bar to postgres2
|
||||||
|
|||||||
@@ -201,6 +201,8 @@ class PatroniController(AbstractController):
|
|||||||
config['name'] = name
|
config['name'] = name
|
||||||
config['postgresql']['data_dir'] = self._data_dir.replace('\\', '/')
|
config['postgresql']['data_dir'] = self._data_dir.replace('\\', '/')
|
||||||
config['postgresql']['basebackup'] = [{'checkpoint': 'fast'}]
|
config['postgresql']['basebackup'] = [{'checkpoint': 'fast'}]
|
||||||
|
config['postgresql']['callbacks'] = {
|
||||||
|
'on_role_change': '{0} features/callback2.py {1}'.format(self._context.pctl.PYTHON, name)}
|
||||||
config['postgresql']['use_unix_socket'] = os.name != 'nt' # windows doesn't yet support unix-domain sockets
|
config['postgresql']['use_unix_socket'] = os.name != 'nt' # windows doesn't yet support unix-domain sockets
|
||||||
config['postgresql']['use_unix_socket_repl'] = os.name != 'nt'
|
config['postgresql']['use_unix_socket_repl'] = os.name != 'nt'
|
||||||
config['postgresql']['pgpass'] = os.path.join(tempfile.gettempdir(), 'pgpass_' + name).replace('\\', '/')
|
config['postgresql']['pgpass'] = os.path.join(tempfile.gettempdir(), 'pgpass_' + name).replace('\\', '/')
|
||||||
|
|||||||
@@ -11,11 +11,8 @@ def start_patroni_with_a_name_value_tag(context, name, tag_name, tag_value):
|
|||||||
|
|
||||||
@then('There is a {label} with "{content}" in {name:w} data directory')
|
@then('There is a {label} with "{content}" in {name:w} data directory')
|
||||||
def check_label(context, label, content, name):
|
def check_label(context, label, content, name):
|
||||||
label = context.pctl.read_label(name, label)
|
value = (context.pctl.read_label(name, label) or '').replace('\n', '\\n')
|
||||||
if label is None:
|
assert content in value, "\"{0}\" in {1} doesn't contain {2}".format(value, label, content)
|
||||||
label = ""
|
|
||||||
label = label.replace('\n', '\\n')
|
|
||||||
assert content in label, "\"{0}\" doesn't contain {1}".format(label, content)
|
|
||||||
|
|
||||||
|
|
||||||
@step('I create label with "{content:w}" in {name:w} data directory')
|
@step('I create label with "{content:w}" in {name:w} data directory')
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
|
|||||||
## Make sure we have a en_US.UTF-8 locale available
|
## Make sure we have a en_US.UTF-8 locale available
|
||||||
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
|
||||||
&& curl https://install.citusdata.com/community/deb.sh | bash \
|
&& curl https://install.citusdata.com/community/deb.sh | bash \
|
||||||
&& apt-get -y install postgresql-15-citus-11.1 \
|
&& apt-get -y install postgresql-15-citus-11.2 \
|
||||||
&& pip3 install setuptools \
|
&& pip3 install setuptools \
|
||||||
&& pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \
|
&& pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \
|
||||||
&& PGHOME=/home/postgres \
|
&& PGHOME=/home/postgres \
|
||||||
|
|||||||
@@ -505,11 +505,12 @@ class Postgresql(object):
|
|||||||
|
|
||||||
if self.callback and cb_name in self.callback:
|
if self.callback and cb_name in self.callback:
|
||||||
cmd = self.callback[cb_name]
|
cmd = self.callback[cb_name]
|
||||||
|
role = 'master' if self.role == 'promoted' else self.role
|
||||||
try:
|
try:
|
||||||
cmd = shlex.split(self.callback[cb_name]) + [cb_name, self.role, self.scope]
|
cmd = shlex.split(self.callback[cb_name]) + [cb_name, role, self.scope]
|
||||||
self._callback_executor.call(cmd)
|
self._callback_executor.call(cmd)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception('callback %s %s %s %s failed', cmd, cb_name, self.role, self.scope)
|
logger.exception('callback %s %s %s %s failed', cmd, cb_name, role, self.scope)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def role(self):
|
def role(self):
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
__version__ = '3.0.0'
|
__version__ = '3.0.1'
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ CLASSIFIERS = [
|
|||||||
'Operating System :: Microsoft :: Windows',
|
'Operating System :: Microsoft :: Windows',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
|
'Programming Language :: Python :: 3.6',
|
||||||
'Programming Language :: Python :: 3.7',
|
'Programming Language :: Python :: 3.7',
|
||||||
'Programming Language :: Python :: 3.8',
|
'Programming Language :: Python :: 3.8',
|
||||||
'Programming Language :: Python :: 3.9',
|
'Programming Language :: Python :: 3.9',
|
||||||
|
|||||||
Reference in New Issue
Block a user