update help elma
This commit is contained in:
@ -1,20 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Кластер Hot Standby PostgreSQL</title>
|
||||
<title>Hot Standby PostgreSQL cluster</title>
|
||||
<meta name="generator" content="Help+Manual" />
|
||||
<meta name="keywords" content="" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="В дополнение к статье «Кластер PostgreSQL» для катастрофоустойчивости можно использовать отдалённый географически Standby кластер PostgreSQL, который обеспечивает высокий..." />
|
||||
<meta name="description" content="As an addition to a PostgreSQL cluster, you can use a geographically separate standby PostgreSQL cluster for disaster tolerance. It maximizes availability and ensures emergency..." />
|
||||
<meta name="picture" content="" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Cправка по Low-code платформе ELMA365" />
|
||||
<meta property="og:url" content="https://elma365.com/ru/help" />
|
||||
<meta property="og:image" content="" />
|
||||
<meta property="og:site_name" content="ELMA365" />
|
||||
<meta property="og:title" content="Full documentation for BRIX365 platform. Low-code developer guide. User guide. Admin guide. Developer guide." />
|
||||
<meta property="og:url" content="https://brix365.com/en/help" />
|
||||
<meta property="og:image" content="" />
|
||||
<link rel="icon" href="favicon.png" type="image/png" />
|
||||
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
||||
@ -24,7 +23,6 @@
|
||||
<link rel="stylesheet" href="./article.css" />
|
||||
<link rel="stylesheet" href="./glossary.css" />
|
||||
<link rel="stylesheet" href="./theme.css" />
|
||||
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="helpman_settings.js"></script>
|
||||
<script type="text/javascript" src="helpman_topicinit.js"></script>
|
||||
@ -36,16 +34,16 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-M6ETBEC1R9"></script><script>window.dataLayer=window.dataLayer || []; function gtag(){dataLayer.push(arguments);}gtag('js', new Date()); gtag('config', 'G-M6ETBEC1R9');</script>
|
||||
|
||||
<script>!function(e,t,c,n,r,a,m){e.ym=e.ym||function(){(e.ym.a=e.ym.a||[]).push(arguments)},e.ym.l=1*new Date;for(var s=0;s<document.scripts.length;s++)if(document.scripts[s].src===n)return;a=t.createElement(c),m=t.getElementsByTagName(c)[0],a.async=1,a.src=n,m.parentNode.insertBefore(a,m)}(window,document,"script","https://mc.yandex.ru/metrika/tag.js"),ym(83179930,"init",{clickmap:!0,trackLinks:!0,accurateTrackBounce:!0,webvisor:!0})</script><noscript><div><img alt=""src=https://mc.yandex.ru/watch/83179930 style=position:absolute;left:-9999px></div></noscript>
|
||||
|
||||
<header class="header elma-365">
|
||||
<div class="container">
|
||||
<a class="header__logo" href="https://elma365.com/ru/help">
|
||||
<img src="./logo.svg" alt="header logo">
|
||||
<a class="header__logo" href="https://brix365.com/en/help">
|
||||
<img src="./logo-en.svg" alt="header logo">
|
||||
</a>
|
||||
<!-- <div class="hero__search-form" id="search-panel">
|
||||
<form class="search-form" onsubmit="ym(83179930,'reachGoal','poisk')">
|
||||
<form class="search-form" onsubmit="ym(83180416,'reachGoal','poisk')">
|
||||
<label class="search-form__label">
|
||||
<span id="reset-search" class="search__icon"></span>
|
||||
<input class="search-form__input" type="text">
|
||||
@ -65,7 +63,7 @@
|
||||
</div>
|
||||
<div class="header__navi">
|
||||
|
||||
<ul class="header__list"><li><span class="solution-select"><span class="solution-select__selected"></span><svg width="7" height="4" viewBox="0 0 7 4" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L3.5 3.5L6 1" stroke="white" stroke-linecap="round" stroke-linejoin="round"/></svg><ul class="solution-select__list"><li><a class="project-link" href="https://elma365.com/ru/help/platform/get-trial.html">Платформа</a></li><li><a class="project-link" href="https://elma365.com/ru/help/ecm/ecm-functions.html">ECM</a></li><li><a class="project-link" href="https://elma365.com/ru/help/crm/crm_overview.html">CRM</a></li><li><a class="project-link" href="https://elma365.com/ru/help/service/service-functions.html">Service</a></li><li><a class="project-link" href="https://elma365.com/ru/help/projects/projects-functions.html">Проекты</a></li><li><a class="project-link" href="https://elma365.com/ru/help/business_solutions/-elma365-store.html">Бизнес-решения</a></li></ul></span></li><li><a href="https://api.elma365.com/ru/"target="_blank">API</a></li><li><a href="https://tssdk.elma365.com/"target="_blank">SDK</a></li><li><a href="https://community.elma365.com/" target="_blank">Community</a></li><li><a href="https://elma-academy.com/ru/" target="_blank">Академия</a></li><li><a href="https://elma365.com/ru/" target="_blank">Сайт ELMA365</a></li></ul>
|
||||
<ul class="header__list"><li><span class="solution-select"><span class="solution-select__selected"></span><svg width="7" height="4" viewBox="0 0 7 4" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L3.5 3.5L6 1" stroke="white" stroke-linecap="round" stroke-linejoin="round"/></svg><ul class="solution-select__list"><li><a class="project-link" href="https://brix365.com/en/help/platform/get-trial.html">Platform</a></li><li><a class="project-link" href="https://brix365.com/en/help/ecm/ecm-functions.html">ECM</a></li><li><a class="project-link" href="https://brix365.com/en/help/crm/crm_overview.html">CRM</a></li><li><a class="project-link" href="https://brix365.com/en/help/service/service-functions.html">Service</a></li><li><a class="project-link" href="https://brix365.com/en/help/projects/projects-functions.html">Projects</a></li><li><a class="project-link" href="https://brix365.com/en/help/business_solutions/-elma365-store.html">Business Solutions</a></li></ul></span></li><li><a href="https://api.brix365.com/en/" target="_blank">API</a></li><li><a href="https://tssdk.brix365.com/" target="_blank">SDK</a></li></ul>
|
||||
|
||||
|
||||
</div>
|
||||
@ -80,8 +78,8 @@
|
||||
|
||||
<aside class="sidebar" id="sidebar">
|
||||
<div class="sidebar__header">
|
||||
<a class="header__logo" href="https://elma365.com/ru/help">
|
||||
<img src="./logo-light.svg">
|
||||
<a class="header__logo" href="https://brix365.com/en/help">
|
||||
<img src="./logo-light-en.svg">
|
||||
</a>
|
||||
<span class="sidebar__close elma-365-close" id="close"></span>
|
||||
</div>
|
||||
@ -94,15 +92,15 @@
|
||||
<div class="article-inner">
|
||||
<div class="content">
|
||||
<header class="article__header">
|
||||
<div class="article__bread" style="display:flex; gap:10px;">
|
||||
<div class="article__bread" style="display:flex; gap:10px;">
|
||||
<span id="subcategory" class="search-res__item-category search-res__item-category_subcategory subcategory article__badge"></span>
|
||||
|
||||
<div class="topic__breadcrumbs">
|
||||
<p><a href="elma365-on-premises.html">ELMA365 On-Premises</a> > <a href="infrastructure-preparation.html">Подготовка инфраструктуры</a> > Базы данных > Отказоустойчивая инфраструктура / Кластер Hot Standby PostgreSQL</p>
|
||||
<p><a href="elma365-on-premises.html">BRIX On-Premises</a> > <a href="infrastructure-preparation.html">Prepare infrastructure</a> > Databases > High availability infrastructure / Hot Standby PostgreSQL cluster</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="topic__title"><h1 class="p_Heading1"><span class="f_Heading1">Кластер Hot Standby PostgreSQL</span></h1>
|
||||
<div class="topic__title"><h1 class="p_Heading1"><span class="f_Heading1">Hot Standby PostgreSQL cluster</span></h1>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
@ -111,100 +109,100 @@
|
||||
<a href="#h1-article" class="scroll-top"></a>
|
||||
</div>
|
||||
<!-- Placeholder for topic body. -->
|
||||
<p class="p_Normal">В дополнение к статье <a href="https://elma365.com/ru/help/configure-postgresql.html" target="_blank" class="weblink">«Кластер PostgreSQL»</a> для катастрофоустойчивости можно использовать отдалённый географически Standby кластер PostgreSQL, который обеспечивает высокий уровень доступности и аварийного восстановления. Standby кластер PostgreSQL содержит только резервные узлы, реплицирующиеся с какого-либо удалённого мастера <a href="https://patroni.readthedocs.io/en/latest/replica_bootstrap.html#standby-cluster" target="_blank" class="weblink">https://patroni.readthedocs.io/en/latest/replica_bootstrap.html#standby-cluster</a>. </p>
|
||||
<p class="p_Normal">Этот тип кластеров имеет:</p>
|
||||
<p style="line-height: 1.20; margin: 7px 0 16px 0;"><span style="font-family: Inter;">As an addition to a <a href="configure-postgresql.html" class="topiclink">PostgreSQL cluster</a>, you can use a geographically separate standby PostgreSQL cluster for disaster tolerance. It maximizes availability and ensures emergency recovery. The standby PostgreSQL cluster only includes backup nodes replicated from a remote primary. Read more: </span><span style="font-family: Inter; color: #0563c1;"><a href="https://patroni.readthedocs.io/en/latest/replica_bootstrap.html#standby-cluster" target="_blank" class="weblink">https://patroni.readthedocs.io/en/latest/replica_bootstrap.html#standby-cluster</a></span><span style="font-family: Inter;">.</span></p>
|
||||
<p style="line-height: 1.20; margin: 7px 0 16px 0;"><span style="font-family: Inter;">This type of clusters has the following elements:</span></p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal">резервный лидер, который ведёт себя почти так же, как обычный лидер кластера, за исключением того, что он реплицируется с удалённого мастера;</li><li class="p_Normal">каскадные реплики, которые реплицируются из резервного лидера.</li></ul>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Шаг 1. Настройка PostgreSQL</span></h2>
|
||||
<li style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">A backup leader acting the same way as a regular leader of the cluster, except that it is replicated from a remote primary.</span></li><li style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">Cascading replicas replicated from the backup leader.</span></li></ul>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Step 1: Configure PostgreSQL</span></h2>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" style="margin-top: 0; margin-right: 0; margin-bottom: 0;">На всех серверах баз данных добавьте в конфигурационный файл <span style="font-weight: bold;">pg_hba.conf </span>информацию о всех узлах каждого кластера, чтобы разрешить соединения с разных серверов:</li></ol>
|
||||
<li value="1" style="line-height: 1.20; margin-top: 0; margin-right: 0; margin-bottom: 0;"><span style="font-family: Inter;">On each database servers, add information about all nodes of each cluster to the </span><code><b>pg_hba.conf</b></code><span style="font-size: 13px;"> </span><span style="font-family: Inter;">file. This will allow for connections from different servers:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">#Patroni</span><br />
|
||||
<span class="f_CodeExample">host all all 0.0.0.0/0 md5</span><br />
|
||||
<span class="f_CodeExample">#Cluster hosts 1</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.1.1/32 md5</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.1.2/32 md5</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.1.3/32 md5</span><br />
|
||||
<span class="f_CodeExample">#Standby сluster hosts 2</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.2.1/32 md5</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.2.2/32 md5</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.2.3/32 md5</span></p>
|
||||
<span class="f_CodeExample">host all all 0.0.0.0/0 md5</span><br />
|
||||
<span class="f_CodeExample">#Cluster hosts 1</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.1.1/32 md5</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.1.2/32 md5</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.1.3/32 md5</span><br />
|
||||
<span class="f_CodeExample">#Standby сluster hosts 2</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.2.1/32 md5</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.2.2/32 md5</span><br />
|
||||
<span class="f_CodeExample">host replication replicator 192.168.2.3/32 md5</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="2">
|
||||
<li value="2" style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">Restart PostgreSQL on all the nodes:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">systemctl restart postgresql</span></p>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Step 2: Configure Patroni</span></h2>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="2">Перезапустите PostgreSQL на всех узлах:</li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">systemctl restart postgresql</span></p>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Шаг 2. Настройка Patroni</span></h2>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" style="margin-top: 0; margin-right: 0; margin-bottom: 0;">На серверах Standby кластера в конфигурационном файле<span style="font-weight: bold;"> /etc/patroni/config.yml </span>поменяйте значения <span style="font-weight: bold;">scope</span>, <span style="font-weight: bold;">name</span>, которые не должны совпадать с основным кластером. Замените адреса всех серверов:</li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">scope: postgres-cluster2 # одинаковое значение на всех узлах Standby кластера</span><br />
|
||||
<span class="f_CodeExample">name: postgresql-server4 # разное значение на всех узлах Standby кластера</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="2">Добавьте раздел standby_cluster в секцию bootstrap, dcs в текущий конфигурационный файл <span style="font-weight: bold;">/etc/patroni/config.yml</span> и укажите удалённого мастера, который в данном примере определяется через haproxy:</li></ol>
|
||||
<li value="1" style="line-height: 1.20; margin-top: 0; margin-right: 0; margin-bottom: 0;"><span style="font-family: Inter;">On the standby cluster’s servers, in the </span><code><b>/etc/patroni/config.yml</b></code><span style="font-size: 13px;"> </span><span style="font-family: Inter;">file, change the values of </span><code><b>scope</b></code><span style="font-family: Inter; font-weight: bold;"> </span><span style="font-family: Inter;">and </span><code><b>name</b></code><span style="font-family: Inter;">, as they shouldn’t be the same as in the main cluster. Edit the addresses of all the servers:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">scope: postgres-cluster2 # The same value for all the nodes of the standby cluster </span><br />
|
||||
<span class="f_CodeExample">name: postgresql-server4 # Different values on each node of the standby cluster</span><span style="font-family: Inter;"> </span></p>
|
||||
<ol style="list-style-type:upper-roman" start="2">
|
||||
<li value="2" style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">Add </span><code><b>standby_cluster</b></code><span style="font-family: Inter;"> to the </span><code><b>bootstrap</b></code><span style="font-family: Inter;"> section. Add </span><code><b>dcs</b></code><span style="font-family: Inter;"> to the current configuration file </span><code><b>/etc/patroni/config.yml</b></code><span style="font-family: Inter;">. Specify the remote primary. In this example, it is defined using HAproxy:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">bootstrap:</span><br />
|
||||
<span class="f_CodeExample">dcs:</span><br />
|
||||
<span class="f_CodeExample"> standby_cluster:</span><br />
|
||||
<span class="f_CodeExample"> host: haproxy-server.your_domain</span><br />
|
||||
<span class="f_CodeExample"> port: 5000</span><br />
|
||||
<span class="f_CodeExample"> host: haproxy-server.your_domain</span><br />
|
||||
<span class="f_CodeExample"> port: 5000</span><br />
|
||||
<span class="f_CodeExample"> create_replica_methods:</span><br />
|
||||
<span class="f_CodeExample"> - basebackup</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="3">На основном и Standby кластере добавьте адреса всех серверов, используемых в кластерах в раздел pg_hba в текущий конфигурационный файл <span style="font-weight: bold;">/etc/patroni/config.yml</span>:</li></ol>
|
||||
<span class="f_CodeExample"> - basebackup</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="3">
|
||||
<li value="3" style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">On the main cluster and the standby cluster, add the addresses of all servers used in them to </span><code><b>pg_hba</b></code><span style="font-family: Inter;"> in the current configuration file </span><code><b>etc/patroni/config.yml</b></code><span style="font-family: Inter;">:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">pg_hba:</span><br />
|
||||
<span class="f_CodeExample">- host all all 0.0.0.0/0 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator localhost trust</span><br />
|
||||
<span class="f_CodeExample">#Cluster hosts 1</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.1.1/32 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.1.2/32 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.1.3/32 md5</span><br />
|
||||
<span class="f_CodeExample">#Cluster hosts 2</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.2.1/32 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.2.2/32 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.2.3/32 md5</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="4">Запустите службу <span style="font-weight: bold;">Patroni</span>:</li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl enable --now patroni.service</span></p>
|
||||
<p class="p_Normal">Если ранее служба Patroni была запущена на Standby кластере, то на каждом узле Standby кластера остановите службу Patroni. Удалите каталог данных postgresql, очистите информацию о кластере и повторно запустите службу Patroni:</p>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl stop patroni</span><br />
|
||||
<span class="f_CodeExample">sudo rm -rf /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/lib/postgresql/10/main</span><br />
|
||||
<span class="f_CodeExample">sudo etcdctl rm --recursive /service/postgres-cluster2</span><br />
|
||||
<span class="f_CodeExample">sudo systemctl restart patroni</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="5">Проверьте состояние Standby кластера:</li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">patronictl -c /etc/patroni/config.yml list</span></p>
|
||||
<p class="p_Normal">Идентификатор кластера должен совпадать с основным кластером, роль у лидера должна быть Standby Leader.</p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="6">В случае недоступности основного кластера для смены режима Standby кластера на основной удалите раздел standby_cluster из текущей конфигурации patroni с помощью команды:</li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">patronictl edit-config --force -s standby_cluster.host='' -s standby_cluster.port='' -s standby_cluster.create_replica_methods=''</span></p>
|
||||
<p class="p_Normal">Важно не допустить работы двух мастеров, в момент восстановления вышедшего ранее основного кластера он также останется мастером.</p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="7">После восстановления вышедшего ранее основного кластера для смены режима с основного на Standby кластер добавьте раздел standby_cluster в текущую конфигурацию patroni с помощью команды:</li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">patronictl edit-config --force -s standby_cluster.host=haproxy-server.your_domain -s standby_cluster.port=5000 -s standby_cluster.create_replica_methods='- basebackup'</span></p>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Шаг 3. Конфигурация HAproxy (блок postgres)</span></h2>
|
||||
<p class="p_Normal">Дополните конфигурацию HAproxy блока postgres указав адреса всех серверов, используемых в кластерах:</p>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">listen postgres_master</span><br />
|
||||
<span class="f_CodeExample"> bind haproxy-server.your_domain:5000</span><br />
|
||||
<span class="f_CodeExample"> option tcplog</span><br />
|
||||
<span class="f_CodeExample"> option httpchk OPTIONS /master</span><br />
|
||||
<span class="f_CodeExample"> http-check expect status 200</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">default</span><span class="f_CodeExample">-server inter 3s fastinter 1s fall 3 rise 4 on-marked-down shutdown-sessions</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server1 postgres-server1.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server2 postgres-server2.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server3 postgres-server3.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server4 postgres-server4.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server5 postgres-server5.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server6 postgres-server6.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample">- host all all 0.0.0.0/0 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator localhost trust</span><br />
|
||||
<span class="f_CodeExample">#Cluster hosts 1</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.1.1/32 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.1.2/32 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.1.3/32 md5</span><br />
|
||||
<span class="f_CodeExample">#Cluster hosts 2</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.2.1/32 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.2.2/32 md5</span><br />
|
||||
<span class="f_CodeExample">- host replication replicator 192.168.2.3/32 md5</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="4">
|
||||
<li value="4" style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">Run the Patroni</span><span style="font-family: Inter; font-weight: bold;"> </span><span style="font-family: Inter;">service:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl enable --now patroni.service</span></p>
|
||||
<p style="line-height: 1.20; margin: 7px 0 16px 0;"><span style="font-family: Inter;">If the Patroni service has been previously started on the standby cluster, stop the service on each of the standby cluster’s nodes. Delete the </span><code><b>postgresql</b></code><span style="font-family: Inter;"> data folder and clear information about the cluster. Run the Patroni service again:</span></p>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl stop patroni</span><br />
|
||||
<span class="f_CodeExample">sudo rm -rf /var/lib/postgresql/10/main</span><br />
|
||||
<span class="f_CodeExample">sudo etcdctl rm --recursive /service/postgres-cluster2</span><br />
|
||||
<span class="f_CodeExample">sudo systemctl restart patroni</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="5">
|
||||
<li value="5" style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">Check the standby cluster’s state:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">patronictl -c /etc/patroni/config.yml list</span></p>
|
||||
<p style="line-height: 1.20; margin: 7px 0 16px 0;"><span style="font-family: Inter;">The standby cluster’s ID has to be the same as the main cluster’s. The leader’s role has to be </span><span style="font-family: Inter; font-weight: bold;">Standby Leader</span><span style="font-family: Inter;">.</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="6">
|
||||
<li value="6" style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">To make the standby cluster become the main one if the original cluster is not available, delete </span><code><b>standby_cluster</b></code><span style="font-family: Inter;"> from the current Patroni configuration by running the following command:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">patronictl edit-config --force -s standby_cluster.host='' -s standby_cluster.port='' -s standby_cluster.create_replica_methods=''</span></p>
|
||||
<p style="line-height: 1.20; margin: 7px 0 16px 0;"><span style="font-family: Inter;">It is important to avoid two primaries working at the same time. When the original cluster is recovered, the backup cluster will still be considered main.</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="7">
|
||||
<li value="7" style="line-height: 1.20; margin-top: 7px; margin-right: 0; margin-bottom: 7px;"><span style="font-family: Inter;">To make the new main cluster become a standby cluster again after the original cluster is recovered, add </span><code><b>standby_cluster</b></code><span style="font-family: Inter;"> to the current Patroni configuration by running the following command:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">patronictl edit-config --force -s standby_cluster.host=haproxy-server.your_domain -s standby_cluster.port=5000 -s standby_cluster.create_replica_methods='- basebackup'</span></p>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Step 3: Configure HAProxy (postgres)</span></h2>
|
||||
<p style="line-height: 1.20; margin: 7px 0 16px 0;"><span style="font-family: Inter;">Complete the configuration of HAProxy in the </span><code><b>postgres</b></code><span style="font-family: Inter;"> section of the file by specifying the addresses of all the servers used in the clusters:</span></p>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">listen postgres_master</span><br />
|
||||
<span class="f_CodeExample"> bind haproxy-server.your_domain:5000</span><br />
|
||||
<span class="f_CodeExample"> option tcplog</span><br />
|
||||
<span class="f_CodeExample"> option httpchk OPTIONS /master</span><br />
|
||||
<span class="f_CodeExample"> http-check expect status 200</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">default</span><span class="f_CodeExample">-server inter 3s fastinter 1s fall 3 rise 4 on-marked-down shutdown-sessions</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server1 postgres-server1.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server2 postgres-server2.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server3 postgres-server3.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server4 postgres-server4.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server5 postgres-server5.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server6 postgres-server6.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> </span><br />
|
||||
<span class="f_CodeExample">listen postgres_replicas</span><br />
|
||||
<span class="f_CodeExample"> bind haproxy-server.your_domain:5001</span><br />
|
||||
<span class="f_CodeExample"> option tcplog</span><br />
|
||||
<span class="f_CodeExample"> option httpchk OPTIONS /replica</span><br />
|
||||
<span class="f_CodeExample"> balance roundrobin</span><br />
|
||||
<span class="f_CodeExample"> http-check expect status 200</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">default</span><span class="f_CodeExample">-server inter 3s fastinter 1s fall 3 rise 2 on-marked-down shutdown-sessions</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server1 postgres-server1.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server2 postgres-server2.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server3 postgres-server3.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server4 postgres-server4.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server5 postgres-server5.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server6 postgres-server6.your_domain:5432 check port 8008</span></p>
|
||||
<span class="f_CodeExample">listen postgres_replicas</span><br />
|
||||
<span class="f_CodeExample"> bind haproxy-server.your_domain:5001</span><br />
|
||||
<span class="f_CodeExample"> option tcplog</span><br />
|
||||
<span class="f_CodeExample"> option httpchk OPTIONS /replica</span><br />
|
||||
<span class="f_CodeExample"> balance roundrobin</span><br />
|
||||
<span class="f_CodeExample"> http-check expect status 200</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">default</span><span class="f_CodeExample">-server inter 3s fastinter 1s fall 3 rise 2 on-marked-down shutdown-sessions</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server1 postgres-server1.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server2 postgres-server2.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server3 postgres-server3.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server4 postgres-server4.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server5 postgres-server5.your_domain:5432 check port 8008</span><br />
|
||||
<span class="f_CodeExample"> server postgres-server6 postgres-server6.your_domain:5432 check port 8008</span></p>
|
||||
|
||||
<div class="bottom-nav">
|
||||
|
||||
@ -221,7 +219,7 @@
|
||||
|
||||
</div>
|
||||
<!-- добавляет на страницу строку блок Была ли статья полезной? -->
|
||||
<div class="feedback-wrap"><div class="feedback" id="feedback"><span><b>Была ли статья полезной?</b></span><form action="" method="POST" class="feedback-form" id="feedback-form"><div class="feedback__popup feedback__popup-response" id="feedback__popup_thx">Спасибо за ваш отзыв!</div><div id="feedback-success-popup"><div class="wrap"><button type="button" class="feedback-popup-close">×</button><svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_212_2187)"><path d="M22 0.6875C10.2294 0.6875 0.6875 10.2294 0.6875 22C0.6875 33.7706 10.2294 43.3125 22 43.3125C33.7706 43.3125 43.3125 33.7706 43.3125 22C43.3125 10.2294 33.7706 0.6875 22 0.6875ZM22 40.5625C11.8023 40.5625 3.4375 32.3078 3.4375 22C3.4375 11.8024 11.6922 3.4375 22 3.4375C32.1977 3.4375 40.5625 11.6922 40.5625 22C40.5625 32.1976 32.3078 40.5625 22 40.5625ZM34.1713 16.933L18.6613 32.3186C18.257 32.7197 17.604 32.7171 17.203 32.3128L9.82283 24.873C9.42176 24.4686 9.42434 23.8157 9.82867 23.4146L10.5609 22.6884C10.9652 22.2873 11.6181 22.2899 12.0192 22.6942L17.9468 28.6697L31.9926 14.7366C32.3969 14.3356 33.0498 14.3382 33.4509 14.7425L34.1772 15.4747C34.5783 15.879 34.5757 16.532 34.1713 16.933Z" fill="#27AE60"></path></g><defs><clipPath id="clip0_212_2187"><rect width="44" height="44" fill="white"></rect></clipPath></defs></svg><p>Ваш отзыв успешно отправлен!</p><span>Спасибо за обратную связь.</span></div></div><div class="feedback__popup" id="feedback__popup_why"><button type="button" class="feedback-popup-close">×</button><div class="feedback__popup-header">Уточните, почему:</div><input type="radio" name="category" id="bad_recommendation" value="bad_recommendation"><label for="bad_recommendation">Рекомендации не помогли</label><input type="radio" name="category" id="difficult_text" value="difficult_text"><label for="difficult_text">Текст трудно понять</label><input type="radio" name="category" id="no_answer" value="no_answer"><label for="no_answer">Нет ответа на мой вопрос</label><input type="radio" name="category" id="bad_header" value="bad_header"><label for="bad_header">Содержание статьи не соответствует заголовку</label><input type="radio" name="category" id="other_reason" value="other_reason"><label for="other_reason">Другая причина</label></div><div class="feedback__popup" id="feedback__popup-other"><button type="button" class="feedback-popup-close">×</button> <div class="feedback__popup-header">Расскажите, что вам не понравилось в статье:</div><textarea class="feedback__textarea" name="other" id=""></textarea><input type="submit" class="feedback__other-btn" value="Отправить"></div><div class="feedback-form__btn-group"><input type="radio" name="useful" id="feedback__useful_yes" value="true"><label for="feedback__useful_yes"><img src="like.svg"/><span class="feedback-form__btn-group_yes-btn">Да</span></label><input type="radio" name="useful" id="feedback__useful_no" value="false"><label for="feedback__useful_no"><img src="dislike.svg"/><span class="feedback-form__btn-group_no-btn">Нет</span></label></div><select name="category"><option disabled>Выберите вариант</option><option value="bad_recommendation" selected>Рекомендации не помогли</option><option value="difficult_text">Текст трудно понять</option><option value="no_answer">Нет ответа на мой вопрос</option><option value="bad_header">Содержание статьи не соответствует заголовку</option><option value="other_reason">Другая причина</option></select><input type="submit"></form></div></div>
|
||||
<div class="feedback" id="feedback"><div class="feedback-help"><span><b>Was this helpful?</b></span><form action="" method="POST" class="feedback-form" id="feedback-form"><div class="feedback__popup feedback__popup-response" id="feedback__popup_thx" style="display: none;">Thanks for your feedback!</div><div class="feedback__popup" id="feedback__popup_why" style="display: none;"><div class="feedback__popup-header">Please specify why:</div><input type="radio" name="category" id="bad_recommendation" value="bad_recommendation"><label for="bad_recommendation">Recommendations did not help me</label><input type="radio" name="category" id="difficult_text" value="difficult_text"><label for="difficult_text">Article is hard to understand</label><input type="radio" name="category" id="no_answer" value="no_answer"><label for="no_answer">Didn`t answer my question</label><input type="radio" name="category" id="bad_header" value="bad_header"><label for="bad_header">Content does not match the topic</label><input type="radio" name="category" id="other_reason" value="other_reason"><label for="other_reason">Other</label></div><div class="feedback__popup" id="feedback__popup-other" style="display: none;"><div class="feedback__popup-header">How we can improve it?</div><textarea class="feedback__textarea" name="other" id=""></textarea><input type="submit" class="feedback__other-btn" value="Submit"></div><div class="feedback-form__btn-group"><input type="radio" name="useful" id="feedback__useful_yes" value="true"><label for="feedback__useful_yes"><img src="like.svg" class="small-img" alt="like"><spanclass="feedback-form__btn-group_yes-btn">Yes</spanclass="feedback-form__btn-group_yes-btn"></label><input type="radio" name="useful" id="feedback__useful_no" value="false"><label for="feedback__useful_no"><img src="dislike.svg" class="small-img" alt="dislike"><spanclass="feedback-form__btn-group_no-btn">No</spanclass="feedback-form__btn-group_no-btn"></label></div><select name="category"><option disabled="">Please specify why</option><option value="bad_recommendation" selected="">Recommendations did not help me</option><option value="difficult_text">Article is hard to understand</option><option value="no_answer">Didn`t answer my question</option><option value="bad_header">Content does not match the topic</option><option value="other_reason">Other</option></select><input type="submit"></form></div><div class="found_typo"><p style="margin: 0px; margin-top: 16px !important;"><span><b>Found a typo?</b></span> Select it and press <i>Ctrl+Enter</i> to send us feedback</p></div></div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
@ -229,7 +227,7 @@
|
||||
<input type="checkbox" />
|
||||
<div class="article__arrow"></div>
|
||||
<div class="table-of-contents elma365-right" id="toc2Content">
|
||||
<h3 class="h3-toc">В этой статье</h3>
|
||||
<h3 class="h3-toc">In this topic</h3>
|
||||
<nav id="toc2"></nav>
|
||||
</div>
|
||||
</aside>
|
||||
@ -240,63 +238,30 @@
|
||||
<div class="footer-container">
|
||||
<div class="footer-mobile">
|
||||
|
||||
<ul class="footer-mobile__list"><li><a href="https://api.elma365.com/ru/" target="_blank">API</a></li><li><a href="https://tssdk.elma365.com/" target="_blank">TS SDK</a></li><li><a href="https://community.elma365.com/" target="_blank">Community</a></li><li><a href="https://elma-academy.com/ru/elma365" target="_blank">Академия</a></li></ul><ul class="footer-mobile__list"><li><a href="https://elma365.com/ru/help/platform/get-trial.html">Платформа</a></li><li><a href="https://elma365.com/ru/help/ecm/ecm-functions.html">ECM</a></li><li><a href="https://elma365.com/ru/help/service/service-functions.html">Service</a></li><li><a href="https://elma365.com/ru/help/projects/projects-functions.html">Проекты</a></li></ul>
|
||||
<ul class="footer-mobile__list"><li><a href="https://brix365.com/en/" target="_blank">BRIX</a></li><li><a href="https://tssdk.brix365.com/en/latest/" target="_blank">SDK</a></li><li><a href="https://api.brix365.com/en/" target="_blank">API</a></li></ul><ul class="footer-mobile__list"><li><a href="https://brix365.com/en/help/platform/get-trial.html">Platform</a></li><li><a href="https://brix365.com/en/help/ecm/ecm-functions.html">ECM</a></li><li><a href="https://brix365.com/en/help/service/service-functions.html">Service</a></li><li><a href="https://brix365.com/en/help/projects/projects-functions.html">Projects</a></li></ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="footer-wrap">
|
||||
|
||||
<div><span class="mobile-question-popup">Отправить фидбэк</span><form method="POST" action class="question__popup question-xs" id="question__popup"><div class="question-wrap"><span class="close"></span><span class="title">Задать вопрос</span><label for="help_question" style="display: none;"></label><textarea name="help_question" id="help_question"></textarea><input type="submit" value="Отправить"></div></form><div class="hidden fade-in question-success-xs">Ваш фидбэк отправлен.</div></div>
|
||||
|
||||
<div class="footer-flex-b">
|
||||
<div class="footer-top">
|
||||
<span class="footer-copy">© 2025
|
||||
ELMA365
|
||||
|
||||
|
||||
</span>
|
||||
|
||||
<a href="https://navigator.sk.ru/orn/1122971" target="_blank">
|
||||
<img src="sk-resident.svg" alt="sk icon" class="footer-img" width="117" height="34">
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="footer-line">
|
||||
|
||||
<div class="footer-line-copy">
|
||||
<span class="footer-copy">© 2025
|
||||
ELMA365
|
||||
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<ul class="footer-list">
|
||||
|
||||
<li class="footer-item"><a href="https://elma365.com/ru/" target="_blank" class="footer-link" style="color: #0D4A75;"><img src="browse.svg" alt="browse icon" class="footer-img">elma365.com</a></li><li class="footer-item"><a href="https://www.youtube.com/user/ELMABPM" target="_blank" class="footer-link"><img src="yt.svg" alt="youtube icon" class="footer-img"></a></li><li class="footer-item"><a href="https://vk.com/elma_bpm" target="_blank" class="footer-link"><img src="vk.svg" alt="vk icon" class="footer-img"></a></li><li class="footer-item"><a href="https://t.me/elmaday" target="_blank" class="footer-link"><img src="tg.svg" alt="telegram icon" class="footer-img"></a></li><li class="footer-item"><a href="https://dzen.ru/elma" target="_blank" class="footer-link"><img src="dzen.svg" alt="dzen icon" class="footer-img"></a></li>
|
||||
|
||||
|
||||
<li class="footer-item">
|
||||
<a href="https://navigator.sk.ru/orn/1122971" target="_blank">
|
||||
<img src="sk-resident.svg" alt="sk icon" class="footer-img" width="117" height="34">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-wrap">
|
||||
|
||||
<div><span class="mobile-question-popup">Send feedback</span><form method="POST" action class="question__popup question-xs" id="question__popup"><div class="question-wrap"><span class="close"></span><span class="title">Ask a question</span><label for="help_question" style="display: none;"></label><textarea name="help_question" id="help_question"></textarea><input type="submit" value="Send"></div></form><div class="hidden fade-in question-success-xs">Sent</div></div>
|
||||
|
||||
<div class="footer-flex-b">
|
||||
<span class="footer-copy">© 2025 BRIX</span>
|
||||
<ul class="footer-list">
|
||||
|
||||
<li class="footer-item">
|
||||
<a href="#" class="arrow-top" style="display: block;"></a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<a href="#" class="arrow-top"></a>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
<!-- <script type="text/javascript" src="jquery1.min.js"></script>-->
|
||||
<iframe name="hmnavigation" style="display:none!important"></iframe>
|
||||
<!--<script src="./jquery-ui.js"></script> -->
|
||||
<script src="./jquery-ui.min.js"></script>
|
||||
<script src="./jquery-ui.js"></script>
|
||||
<!--script src="//cdn.jsdelivr.net/npm/featherlight@1.7.14/release/featherlight.min.js" type="text/javascript" charset="utf-8"></script-->
|
||||
<script src="./jquery.tocify.min.js"></script>
|
||||
<script src="./TypoReporter.min.js"></script>
|
||||
|
Reference in New Issue
Block a user