All checks were successful
Deploy Static Site / deploy (push) Successful in 6m6s
805 lines
90 KiB
HTML
805 lines
90 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<title>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="To ensure the correct operation of the system, PostgreSQL version 10–15 is required. The article describes the installation of PostgreSQL 13 for Ubuntu Linux 20.04 and 22.04...." />
|
||
<meta name="picture" content="" />
|
||
<meta property="og:type" content="website" />
|
||
<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" />
|
||
<link rel="stylesheet" href="./jquery-ui.min.css" />
|
||
<link rel="stylesheet" href="default.css" />
|
||
<link rel="stylesheet" href="./search-yandex.css" />
|
||
<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>
|
||
|
||
<script type="text/javascript" src="highlight.js"></script>
|
||
<script type="text/javascript">
|
||
$(document).ready(function(){highlight();});
|
||
</script>
|
||
</head>
|
||
|
||
<body>
|
||
|
||
<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://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(83180416,'reachGoal','poisk')">
|
||
<label class="search-form__label">
|
||
<span id="reset-search" class="search__icon"></span>
|
||
<input class="search-form__input" type="text">
|
||
</label>
|
||
<input class="search-form__submit" type="submit" value="Submit">
|
||
</form>
|
||
</div> -->
|
||
|
||
<div class="hero__search-form" id="search-panel"> <form class="search-form"> <label class="search-form__label"> <span id="reset-search" class="search__icon"></span> <input class="search-form__input" type="text"> </label> <input class="search-form__submit" type="submit" value="Submit"> </form> </div>
|
||
<div class="hero__search">
|
||
<a href="#" id="search-icon" class="hero__search-icon">
|
||
<img src="search-icon-white.svg" alt="search string">
|
||
</a>
|
||
<a href="#" id="side-menu-icon" class="hero__side-icon">
|
||
<img src="side_menu.svg" alt="side menu">
|
||
</a>
|
||
</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://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>
|
||
</div>
|
||
|
||
</header>
|
||
|
||
|
||
|
||
|
||
<main class="main container">
|
||
|
||
<aside class="sidebar" id="sidebar">
|
||
<div class="sidebar__header">
|
||
<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>
|
||
<div class="sidebar__wrapper" id="side-menu">
|
||
|
||
</div>
|
||
</aside>
|
||
|
||
<article class="article" id="article">
|
||
<div class="article-inner">
|
||
<div class="content">
|
||
<header class="article__header">
|
||
<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">BRIX On-Premises</a> > <a href="infrastructure-preparation.html">Prepare infrastructure</a> > Databases > High availability infrastructure / PostgreSQL cluster</p>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="topic__title"><h1 class="p_Heading1"><span class="f_Heading1">PostgreSQL cluster</span></h1>
|
||
</div>
|
||
|
||
</header>
|
||
<section class="article__content">
|
||
<div class="scroll-top-inner">
|
||
<a href="#h1-article" class="scroll-top"></a>
|
||
</div>
|
||
<!-- Placeholder for topic body. -->
|
||
<p class="p_Normal" style="line-height: 1.20;">To ensure the correct operation of the system, PostgreSQL version 10–15 is required. The article describes the installation of PostgreSQL 13 for Ubuntu Linux 20.04 and 22.04. You can also refer to the <a href="https://www.postgresql.org/docs/13/high-availability.html" target="_blank" class="weblink">official PostgreSQL documentation</a>.</p>
|
||
<p class="p_Normal" style="line-height: 1.20;">The installation consists of 10 steps:</p>
|
||
<ol style="list-style-type:decimal">
|
||
<li value="1" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#preparation-node" class="topiclink">Prepare nodes (servers)</a>.</li><li value="2" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#preparation-etcd" class="topiclink">Prepare the etcd cluster</a>.</li><li value="3" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#install-postgresql" class="topiclink">Install PostgreSQL</a>.</li><li value="4" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#setting-postgresql" class="topiclink">Configure PostgreSQL</a>.</li><li value="5" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#install-patroni" class="topiclink">Install Patroni</a>.</li><li value="6" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#setting-patroni" class="topiclink">Configure Patroni</a>.</li><li value="7" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#preparation-postgresql-patroni" class="topiclink">Prepare the PostgreSQL+Patroni cluster</a>.</li><li value="8" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#prepare-pgbouncer" class="topiclink">Prepare PGBouncer (optional)</a>.</li><li value="9" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#haproxy-configuration" class="topiclink">Configure HAProxy (postgres block)</a>.</li><li value="10" class="p_Normal" style="line-height: 1.20;"><a href="configure-postgresql.html#connecting-to-postgresql" class="topiclink">Connect to PostgreSQL</a>.</li></ol>
|
||
<h2 class="p_Heading2"><a id="preparation-node" class="hmanchor"></a><span class="f_Heading2">Step 1: Prepare nodes (servers)</span></h2>
|
||
<p class="p_Normal">Create three nodes (servers) with sequentially numbered host names.</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">начало внимание</span></p>
|
||
<p class="p_Normal">The minimum number of servers for organizing a cluster is three.</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">конец внимание</span></p>
|
||
<p class="p_Normal" style="line-height: 1.50;"><span style="font-size: 15px;">In this example, three nodes with the following hostnames and IP addresses are used:</span></p>
|
||
<ul style="list-style-type:disc">
|
||
<li class="p_Normal"><span style="font-weight: bold;">postgres-server1.your_domain, 192.168.1.1</span>;</li><li class="p_Normal"><span style="font-weight: bold;">postgres-server2.your_domain, 192.168.1.2</span>;</li><li class="p_Normal"><span style="font-weight: bold;">postgres-server3.your_domain, 192.168.1.3</span>.</li></ul>
|
||
<p class="p_Normal">Create the necessary host name mappings in DNS. If not possible, add the required entries in <code><b>/etc/hosts</b></code>.</p>
|
||
<h2 class="p_Heading2"><a id="preparation-etcd" class="hmanchor"></a><span class="f_Heading2">Step 2: Prepare the etcd cluster</span></h2>
|
||
<ol style="list-style-type:upper-roman">
|
||
<li value="1" class="p_Normal" style="line-height: 1.68; margin-top: 10px; margin-right: 0; margin-bottom: 0;">Install <code><b>etcd</b></code> on all nodes:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo apt-</span><span class="f_CodeExample" style="font-weight: bold;">get</span><span class="f_CodeExample"> install etcd -y</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="2" class="p_Normal" style="line-height: 1.68;">Stop <code><b>etcd</b></code> on all nodes:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl stop etcd</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="3" class="p_Normal" style="line-height: 1.68;">Remove the data directory:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo rm -rf /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/lib/etcd</span><span class="f_CodeExample" style="font-style: italic;">/*</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="4" class="p_Normal" style="line-height: 1.68;">Move the default configuration file:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo mv /etc/default/etcd{,.original}</span></p>
|
||
<ol style="list-style-type:upper-roman" start="5">
|
||
<li value="5" class="p_Normal" style="line-height: 1.68;">Create and open a new configuration file for editing:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo nano /etc/default/etcd</span></p>
|
||
<ol style="list-style-type:upper-roman" start="6">
|
||
<li value="6" class="p_Normal" style="line-height: 1.68;">Add the example configurations for the<span style="font-weight: bold;"> postgres-server1.your_domain</span> node:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">ETCD_NAME="postgres-server1"</span><br />
|
||
<span class="f_CodeExample">ETCD_DATA_DIR="/var/lib/etcd/default"</span><br />
|
||
<span class="f_CodeExample">ETCD_HEARTBEAT_INTERVAL="1000"</span><br />
|
||
<span class="f_CodeExample">ETCD_ELECTION_TIMEOUT="5000"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_PEER_URLS="http://192.168.1.1:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_CLIENT_URLS="http://192.168.1.1:2379,http://localhost:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.1.1:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER="postgres-server1=http://192.168.1.1:2380,postgres-server2=http://192.168.1.2:2380,postgres-server3=http://192.168.1.3:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_STATE="new"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_TOKEN="etcd-postgres-cluster"</span><br />
|
||
<span class="f_CodeExample">ETCD_ADVERTISE_CLIENT_URLS="http://192.168.1.1:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_ENABLE_V2="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ELECTION_TICK_ADVANCE="false"</span></p>
|
||
<p class="p_Normal"><a class="dropdown-toggle" style="font-style: normal; font-weight: normal; color: #000000; background-color: transparent; text-decoration: none;" href="javascript:HMToggle('toggle','TOGGLE0186A1')">Example configurations with enabling TLS/SSL for the postgres-server1.your_domain node:</a></p>
|
||
<div id="TOGGLE0186A1" class="dropdown-toggle-body" style="text-align: left; text-indent: 0; line-height: 1.80; padding: 0 0 0 0; margin: 0 0 0 0;"><table style="border:none; border-spacing:0;">
|
||
<tr>
|
||
<td style="vertical-align:top; padding:0; border:none"><p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">ETCD_NAME="postgres-server1"</span><br />
|
||
<span class="f_CodeExample">ETCD_DATA_DIR="/var/lib/etcd/default"</span><br />
|
||
<span class="f_CodeExample">ETCD_HEARTBEAT_INTERVAL="1000"</span><br />
|
||
<span class="f_CodeExample">ETCD_ELECTION_TIMEOUT="5000"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_PEER_URLS="https://192.168.1.1:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_CLIENT_URLS="https://192.168.1.1:2379,https://localhost:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ADVERTISE_PEER_URLS="https://postgres-server1.your_domain:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER="postgres-server1=https://postgres-server1.your_domain:2380,postgres-server2=https://postgres-server2.your_domain:2380,postgres-server3=https://postgres-server3.your_domain:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_STATE="new"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_TOKEN="etcd-postgres-cluster"</span><br />
|
||
<span class="f_CodeExample">ETCD_ADVERTISE_CLIENT_URLS="https://postgres-server1.your_domain:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_ENABLE_V2="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_CERT_FILE="/path/to/public.crt"</span><br />
|
||
<span class="f_CodeExample">ETCD_KEY_FILE="/path/to/private.key"</span><br />
|
||
<span class="f_CodeExample">ETCD_CLIENT_CERT_AUTH="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_TRUSTED_CA_FILE="/path/to/certCA.pem"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_CERT_FILE="/path/to/public.crt"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_KEY_FILE="/path/to/private.key"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_CLIENT_CERT_AUTH="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_TRUSTED_CA_FILE="/path/to/certCA.pem"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ELECTION_TICK_ADVANCE="false"</span></p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<ol style="list-style-type:upper-roman" start="7">
|
||
<li value="7" class="p_Normal" style="line-height: 1.68;">Add the example configurations to the file for the <span style="font-weight: bold;">postgres-server2.your_domain </span>node:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">ETCD_NAME="postgres-server2"</span><br />
|
||
<span class="f_CodeExample">ETCD_DATA_DIR="/var/lib/etcd/default"</span><br />
|
||
<span class="f_CodeExample">ETCD_HEARTBEAT_INTERVAL="1000"</span><br />
|
||
<span class="f_CodeExample">ETCD_ELECTION_TIMEOUT="5000"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_PEER_URLS="http://192.168.1.2:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_CLIENT_URLS="http://192.168.1.2:2379,http://127.0.0.1:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.1.2:12380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER="postgres-server1=http://192.168.1.1:12380,postgres-server2=http://192.168.1.2:12380,postgres-server3=http://192.168.1.3:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_STATE="new"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_TOKEN="etcd-postgres-cluster"</span><br />
|
||
<span class="f_CodeExample">ETCD_ADVERTISE_CLIENT_URLS="http://192.168.1.2:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_ENABLE_V2="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ELECTION_TICK_ADVANCE="false"</span></p>
|
||
<p class="p_Normal"><a class="dropdown-toggle" style="font-style: normal; font-weight: normal; color: #000000; background-color: transparent; text-decoration: none;" href="javascript:HMToggle('toggle','TOGGLE0186A2')">Example configurations with enabling TLS/SSL for the postgres-server2.your_domain:</a></p>
|
||
<div id="TOGGLE0186A2" class="dropdown-toggle-body" style="text-align: left; text-indent: 0; line-height: 1.80; padding: 0 0 0 0; margin: 0 0 0 0;"><table style="border:none; border-spacing:0;">
|
||
<tr>
|
||
<td style="vertical-align:top; padding:0; border:none"><p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">ETCD_NAME="postgres-server2"</span><br />
|
||
<span class="f_CodeExample">ETCD_DATA_DIR="/var/lib/etcd/default"</span><br />
|
||
<span class="f_CodeExample">ETCD_HEARTBEAT_INTERVAL="1000"</span><br />
|
||
<span class="f_CodeExample">ETCD_ELECTION_TIMEOUT="5000"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_PEER_URLS="https://192.168.1.2:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_CLIENT_URLS="https://192.168.1.2:2379,https://localhost:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ADVERTISE_PEER_URLS="https://postgres-server2.your_domain:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER="postgres-server1=https://postgres-server1.your_domain:2380,postgres-server2=https://postgres-server2.your_domain:2380,postgres-server3=https://postgres-server3.your_domain:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_STATE="new"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_TOKEN="etcd-postgres-cluster"</span><br />
|
||
<span class="f_CodeExample">ETCD_ADVERTISE_CLIENT_URLS="https://postgres-server2.your_domain:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_ENABLE_V2="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_CERT_FILE="/path/to/public.crt"</span><br />
|
||
<span class="f_CodeExample">ETCD_KEY_FILE="/path/to/private.key"</span><br />
|
||
<span class="f_CodeExample">ETCD_CLIENT_CERT_AUTH="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_TRUSTED_CA_FILE="/path/to/certCA.pem"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_CERT_FILE="/path/to/public.crt"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_KEY_FILE="/path/to/private.key"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_CLIENT_CERT_AUTH="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_TRUSTED_CA_FILE="/path/to/certCA.pem"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ELECTION_TICK_ADVANCE="false"</span></p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<ol style="list-style-type:upper-roman" start="8">
|
||
<li value="8" class="p_Normal" style="line-height: 1.68;">Add the example configurations to the file for the <span style="font-weight: bold;">postgres-server3.your_domain </span>node:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">ETCD_NAME="postgres-server3"</span><br />
|
||
<span class="f_CodeExample">ETCD_DATA_DIR="/var/lib/etcd/default"</span><br />
|
||
<span class="f_CodeExample">ETCD_HEARTBEAT_INTERVAL="1000"</span><br />
|
||
<span class="f_CodeExample">ETCD_ELECTION_TIMEOUT="5000"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_PEER_URLS="http://192.168.1.3:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_CLIENT_URLS="http://192.168.1.3:2379,http://localhost:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.1.3:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER="postgres-server1=http://192.168.1.1:2380,postgres-server2=http://192.168.1.2:2380,postgres-server3=http://192.168.1.3:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_STATE="new"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_TOKEN="etcd-postgres-cluster"</span><br />
|
||
<span class="f_CodeExample">ETCD_ADVERTISE_CLIENT_URLS="http://192.168.1.3:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_ENABLE_V2="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ELECTION_TICK_ADVANCE="false"</span></p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><a class="dropdown-toggle" style="font-style: normal; font-weight: normal; color: #000000; background-color: transparent; text-decoration: none;" href="javascript:HMToggle('toggle','TOGGLE0186A3')">Example configurations with enabling TLS/SSL for the postgres-server3.your_domain:</a></p>
|
||
<div id="TOGGLE0186A3" class="dropdown-toggle-body" style="text-align: left; text-indent: 0; line-height: 1.0; page-break-inside: avoid; padding: 0 0 0 0; margin: 0 0 0 0;"><table style="border:none; border-spacing:0;">
|
||
<tr>
|
||
<td style="vertical-align:top; padding:0; border:none"><p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">ETCD_NAME="postgres-server3"</span><br />
|
||
<span class="f_CodeExample">ETCD_DATA_DIR="/var/lib/etcd/default"</span><br />
|
||
<span class="f_CodeExample">ETCD_HEARTBEAT_INTERVAL="1000"</span><br />
|
||
<span class="f_CodeExample">ETCD_ELECTION_TIMEOUT="5000"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_PEER_URLS="https://192.168.1.3:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_LISTEN_CLIENT_URLS="https://192.168.1.3:2379,https://localhost:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ADVERTISE_PEER_URLS="https://postgres-server3.your_domain:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER="postgres-server1=https://postgres-server1.your_domain:2380,postgres-server2=https://postgres-server2.your_domain:2380,postgres-server3=https://postgres-server3.your_domain:2380"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_STATE="new"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_CLUSTER_TOKEN="etcd-postgres-cluster"</span><br />
|
||
<span class="f_CodeExample">ETCD_ADVERTISE_CLIENT_URLS="https://postgres-server3.your_domain:2379"</span><br />
|
||
<span class="f_CodeExample">ETCD_ENABLE_V2="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_CERT_FILE="/path/to/public.crt"</span><br />
|
||
<span class="f_CodeExample">ETCD_KEY_FILE="/path/to/private.key"</span><br />
|
||
<span class="f_CodeExample">ETCD_CLIENT_CERT_AUTH="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_TRUSTED_CA_FILE="/path/to/certCA.pem"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_CERT_FILE="/path/to/public.crt"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_KEY_FILE="/path/to/private.key"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_CLIENT_CERT_AUTH="true"</span><br />
|
||
<span class="f_CodeExample">ETCD_PEER_TRUSTED_CA_FILE="/path/to/certCA.pem"</span><br />
|
||
<span class="f_CodeExample">ETCD_INITIAL_ELECTION_TICK_ADVANCE="false"</span></p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<p class="p_Normal" style="line-height: 1.68;">Let's review the provided parameters:</p>
|
||
<ul style="list-style-type:disc">
|
||
<li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_NAME</b></code>: Unique name within the cluster;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_LISTEN_CLIENT_URLS</b></code>: Connection point for clients in the cluster;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_ADVERTISE_CLIENT_URLS</b></code>: URLs through which other cluster nodes can be found.;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_LISTEN_PEER_URLS</b></code>: Connection point for other nodes in the cluster;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_INITIAL_ADVERTISE_PEER_URLS</b></code>: Initial URLs through which other nodes can find it;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_INITIAL_CLUSTER_TOKEN</b></code>: Token for the cluster, must be the same on all nodes.;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_INITIAL_CLUSTER</b></code>: List of nodes in the cluster at startup;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_INITIAL_CLUSTER_STATE</b></code>: Can take two values: <code><b>new</b></code> and <code><b>existing</b></code>;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_DATA_DIR</b></code>: Location of the cluster's data directory;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_ELECTION_TIMEOUT</b></code>: Time in milliseconds between the last received notification from the cluster leader and attempting to take over the leader role on the follower node;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_HEARTBEAT_INTERVAL</b></code>: Time in milliseconds between leader notifications sent by the leader node to inform others that it is still the leader;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_CERT_FILE</b></code>: Path to the server certificate file;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_KEY_FILE</b></code>: Path to the private key file;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_TRUSTED_CA_FILE</b></code>: Path to the root CA file;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_CLIENT_CERT_AUTH</b></code>: Can take two values: <code><b>true</b></code> and <code><b>false</b></code>;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_PEER_CERT_FILE</b></code>: Path to the server certificate file;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_PEER_KEY_FILE</b></code>: Path to the private key file;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_PEER_TRUSTED_CA_FILE</b></code>: Path to the root CA file;</li><li class="p_Normal" style="line-height: 1.68;"><code><b>ETCD_PEER_CLIENT_CERT_AUTH</b></code>: Can take two values: <code><b>true</b></code> and <code><b>false</b></code>;</li></ul>
|
||
<ol style="list-style-type:upper-roman" start="9">
|
||
<li value="9" class="p_Normal" style="line-height: 1.68;">Restart <code><b>etcd</b></code> on all nodes:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl restart etcd</span></p>
|
||
<ol style="list-style-type:upper-roman" start="10">
|
||
<li value="10" class="p_Normal" style="line-height: 1.68;">Check the cluster status.</li></ol>
|
||
<p class="p_Normal" style="line-height: 1.68;">For a cluster without TLS:</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo etcdctl cluster-health</span></p>
|
||
<p class="p_Normal">For a cluster with TLS:</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo etcdctl -C https:</span><span class="f_CodeExample">//postgres-server1.your_domain:2379 --key-file /path/to/private.key --cert-file /path/to/public.crt --ca-file /path/to/certCA.pem cluster-health</span></p>
|
||
<h2 class="p_Heading2"><a id="install-postgresql" class="hmanchor"></a><span class="f_Heading2">Step 3: Install PostgreSQL</span></h2>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">начало внимание</span></p>
|
||
<p class="p_Normal">Hardware requirements for BRIX on PostgreSQL can be found in <a href="elma365-enterprise-on-premises.html#postgresql" class="topiclink">System requirements for BRIX On-Premises Enterprise</a>.</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">конец внимание</span></p>
|
||
<ol style="list-style-type:upper-roman">
|
||
<li value="1" class="p_Normal">To install PostgreSQL, add the official repository <code><b>postgresql</b></code>:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'</span><br />
|
||
<span class="f_CodeExample">wget --quiet -O - https:</span><span class="f_CodeExample">//www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="2" class="p_Normal">Update package cache:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo apt update</span></p>
|
||
<ol style="list-style-type:upper-roman" start="3">
|
||
<li value="3" class="p_Normal">Install PostgreSQL on all nodes:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo apt install postgresql-13 -y</span></p>
|
||
<h2 class="p_Heading2"><a id="setting-postgresql" class="hmanchor"></a><span class="f_Heading2">Step 4: Configure PostgreSQL</span></h2>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">начало примечание</span></p>
|
||
<p class="p_Normal"><span style="font-weight: bold;">Note</span></p>
|
||
<p class="p_Normal">For the password, the following characters are allowed:</p>
|
||
<ul style="list-style-type:disc">
|
||
<li class="p_Normal">Uppercase Latin letters: A to Z</li><li class="p_Normal">Lowercase Latin letters: a to z</li><li class="p_Normal">Digits: 0 to 9</li><li class="p_Normal">Symbols: -_</li></ul>
|
||
<p class="p_Normal">Reserved (invalid) symbols:</p>
|
||
<p class="p_Normal">! * ' ( ) ; : @ & = + $ , / ? % # [ ]</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">конец примечание</span></p>
|
||
<h4 class="p_Heading4"><span class="f_Heading4">Actions for the node postgres-server1.your_domain:</span></h4>
|
||
<ol style="list-style-type:upper-roman">
|
||
<li value="1" class="p_Normal">Create a new role <code><b>elma365</b></code> with the password <span style="font-weight: bold;">SecretPassword</span>:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo -u postgres psql -c \</span><br />
|
||
<span class="f_CodeExample">"CREATE ROLE elma365 WITH login password 'SecretPassword';"</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="2" class="p_Normal">Create a database <code><b>elma365</b></code> with owner <span style="font-weight: bold;">elma365</span>:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo -u postgres psql -c \</span><br />
|
||
<span class="f_CodeExample">"CREATE DATABASE elma365 WITH OWNER elma365;"</span></p>
|
||
<ol style="list-style-type:upper-roman" start="3">
|
||
<li value="3" class="p_Normal">Add necessary extensions for the database <code><b>elma365</b></code>:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo -u postgres psql -d elma365 -c \</span><br />
|
||
<span class="f_CodeExample">"CREATE EXTENSION \"uuid-ossp\"; CREATE EXTENSION pg_trgm;"</span></p>
|
||
<ol style="list-style-type:upper-roman" start="4">
|
||
<li value="4" class="p_Normal">Create a new role <code><b>replicator</b></code> with the password <span style="font-weight: bold;">ReplicatorPassword</span> for working with replicas. It must match the Patroni settings in the block <code><b>postgresql - authentication - replication</b></code> and the list of allowed PostgreSQL hosts in the file <code><b>pg_hba.conf</b></code>:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo -u postgres psql -c \</span><br />
|
||
<span class="f_CodeExample">"CREATE USER replicator WITH REPLICATION ENCRYPTED PASSWORD 'ReplicatorPassword';"</span></p>
|
||
<ol style="list-style-type:upper-roman" start="5">
|
||
<li value="5" class="p_Normal">Set a password for the <span style="font-weight: bold;">postgres</span> user:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'PostgresPassword';"</span></p>
|
||
<ol style="list-style-type:upper-roman" start="6">
|
||
<li value="6" class="p_Normal">Stop PostgreSQL:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">systemctl stop postgresql</span></p>
|
||
<h4 class="p_Heading4"><span class="f_Heading4">Actions for the nodes postgres-server2.your_domain and postgres-server3.your_domain:</span></h4>
|
||
<ol style="list-style-type:upper-roman">
|
||
<li value="1" class="p_Normal"> Stop PostgreSQL:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">systemctl stop postgresql</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="2" class="p_Normal">Remove the data directory on the nodes <span style="font-weight: bold;">postgres-server2.your_domain</span> and <span style="font-weight: bold;">postgres-server3.your_domain</span>:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">rm -rf /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/lib/postgresql/13/main</span></p>
|
||
<h2 class="p_Heading2"><a id="install-patroni" class="hmanchor"></a><span class="f_Heading2">Step 5: Install Patroni</span></h2>
|
||
<ol style="list-style-type:upper-roman">
|
||
<li value="1" class="p_Normal">Install Patroni and PIP on all nodes:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo apt-get install python3-pip python3-dev libpq-dev -y</span><br />
|
||
<span class="f_CodeExample">sudo apt-get install patroni -y</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="2" class="p_Normal">Install dependencies for Patroni to work on all nodes:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">pip3 install psycopg2-binary</span><br />
|
||
<span class="f_CodeExample">pip3 install wheel</span><br />
|
||
<span class="f_CodeExample">pip3 install python-etcd</span></p>
|
||
<h2 class="p_Heading2"><a id="setting-patroni" class="hmanchor"></a><span class="f_Heading2">Step 6: Configure Patroni</span></h2>
|
||
<ol style="list-style-type:upper-roman">
|
||
<li value="1" class="p_Normal">Create a configuration file:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo nano /etc/patroni/config.yml</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="2" class="p_Normal">Place an example initial configuration in the created <code><b>/etc/patroni/config.yml</b></code> file, changing the IP addresses for each node in the cluster. Pay attention to the comments in this file.</li></ol>
|
||
<p class="p_Normal"><a class="dropdown-toggle" style="font-style: normal; font-weight: normal; color: #000000; background-color: transparent; text-decoration: none;" href="javascript:HMToggle('toggle','TOGGLE0186A4')">Example initial configuration </a></p>
|
||
<div id="TOGGLE0186A4" class="dropdown-toggle-body" style="text-align: left; text-indent: 0; line-height: 1.80; padding: 0 0 0 0; margin: 0 0 0 0;"><table style="border:none; border-spacing:0;">
|
||
<tr>
|
||
<td style="vertical-align:top; padding:0; border:none"><p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">scope: postgres-cluster # the same value on all nodes</span><br />
|
||
<span class="f_CodeExample">name: postgresql-server1 # different values on all nodes</span><br />
|
||
<span class="f_CodeExample">namespace: /service/ # the same value on all nodes</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">restapi:</span><br />
|
||
<span class="f_CodeExample"> listen: postgres-server1.your_domain:8008 # address of the node where the file is</span><br />
|
||
<span class="f_CodeExample"> connect_address: postgres-server1.your_domain:8008 # address of the node where the file is</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">etcd:</span><br />
|
||
<span class="f_CodeExample"> hosts: postgres-server1.your_domain:2379,postgres-server2.your_domain:2379,postgres-server3.your_domain:2379 # list of all the nodes with installed etcd</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">bootstrap:</span><br />
|
||
<span class="f_CodeExample"> method: initdb</span><br />
|
||
<span class="f_CodeExample"> dcs:</span><br />
|
||
<span class="f_CodeExample"> ttl: 30</span><br />
|
||
<span class="f_CodeExample"> loop_wait: 10</span><br />
|
||
<span class="f_CodeExample"> retry_timeout: 10</span><br />
|
||
<span class="f_CodeExample"> maximum_lag_on_failover: 1048576</span><br />
|
||
<span class="f_CodeExample"> master_start_timeout: 300</span><br />
|
||
<span class="f_CodeExample"> synchronous_mode: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> synchronous_mode_strict: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> synchronous_node_count: 1</span><br />
|
||
<span class="f_CodeExample"> postgresql:</span><br />
|
||
<span class="f_CodeExample"> use_pg_rewind: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> use_slots: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> parameters:</span><br />
|
||
<span class="f_CodeExample"> max_connections: 2000</span><br />
|
||
<span class="f_CodeExample"> superuser_reserved_connections: 5</span><br />
|
||
<span class="f_CodeExample"> max_locks_per_transaction: 64</span><br />
|
||
<span class="f_CodeExample"> max_prepared_transactions: 0</span><br />
|
||
<span class="f_CodeExample"> huge_pages: </span><span class="f_CodeExample" style="font-weight: bold;">try</span><br />
|
||
<span class="f_CodeExample"> shared_buffers: 512MB</span><br />
|
||
<span class="f_CodeExample"> work_mem: 128MB</span><br />
|
||
<span class="f_CodeExample"> maintenance_work_mem: 256MB</span><br />
|
||
<span class="f_CodeExample"> effective_cache_size: 4GB</span><br />
|
||
<span class="f_CodeExample"> checkpoint_timeout: 15min</span><br />
|
||
<span class="f_CodeExample"> checkpoint_completion_target: 0.9</span><br />
|
||
<span class="f_CodeExample"> wal_compression: on</span><br />
|
||
<span class="f_CodeExample"> min_wal_size: 2GB</span><br />
|
||
<span class="f_CodeExample"> max_wal_size: 4GB</span><br />
|
||
<span class="f_CodeExample"> wal_buffers: 32MB</span><br />
|
||
<span class="f_CodeExample"> default_statistics_target: 1000</span><br />
|
||
<span class="f_CodeExample"> seq_page_cost: 1</span><br />
|
||
<span class="f_CodeExample"> random_page_cost: 4</span><br />
|
||
<span class="f_CodeExample"> effective_io_concurrency: 2</span><br />
|
||
<span class="f_CodeExample"> synchronous_commit: on</span><br />
|
||
<span class="f_CodeExample"> autovacuum: on</span><br />
|
||
<span class="f_CodeExample"> autovacuum_max_workers: 5</span><br />
|
||
<span class="f_CodeExample"> autovacuum_vacuum_scale_factor: 0.01</span><br />
|
||
<span class="f_CodeExample"> autovacuum_analyze_scale_factor: 0.02</span><br />
|
||
<span class="f_CodeExample"> autovacuum_vacuum_cost_limit: 200</span><br />
|
||
<span class="f_CodeExample"> autovacuum_vacuum_cost_delay: 20</span><br />
|
||
<span class="f_CodeExample"> autovacuum_naptime: 1s</span><br />
|
||
<span class="f_CodeExample"> max_files_per_process: 4096</span><br />
|
||
<span class="f_CodeExample"> archive_mode: on</span><br />
|
||
<span class="f_CodeExample"> archive_timeout: 1800s</span><br />
|
||
<span class="f_CodeExample"> archive_command: cd .</span><br />
|
||
<span class="f_CodeExample"> wal_level: replica</span><br />
|
||
<span class="f_CodeExample"> wal_keep_segments: 130</span><br />
|
||
<span class="f_CodeExample"> max_wal_senders: 10</span><br />
|
||
<span class="f_CodeExample"> max_replication_slots: 10</span><br />
|
||
<span class="f_CodeExample"> hot_standby: on</span><br />
|
||
<span class="f_CodeExample"> hot_standby_feedback: True</span><br />
|
||
<span class="f_CodeExample"> wal_log_hints: on</span><br />
|
||
<span class="f_CodeExample"> shared_preload_libraries: pg_stat_statements,auto_explain</span><br />
|
||
<span class="f_CodeExample"> pg_stat_statements.max: 10000</span><br />
|
||
<span class="f_CodeExample"> pg_stat_statements.track: all</span><br />
|
||
<span class="f_CodeExample"> pg_stat_statements.save: off</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_min_duration: 10s</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_analyze: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_buffers: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_timing: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_triggers: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_verbose: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_nested_statements: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> standard_conforming_strings: true</span><br />
|
||
<span class="f_CodeExample"> track_io_timing: on</span><br />
|
||
<span class="f_CodeExample"> log_lock_waits: on</span><br />
|
||
<span class="f_CodeExample"> log_temp_files: 3</span><br />
|
||
<span class="f_CodeExample"> track_activities: on</span><br />
|
||
<span class="f_CodeExample"> track_counts: on</span><br />
|
||
<span class="f_CodeExample"> track_functions: all</span><br />
|
||
<span class="f_CodeExample"> log_checkpoints: on</span><br />
|
||
<span class="f_CodeExample"> logging_collector: on</span><br />
|
||
<span class="f_CodeExample"> log_truncate_on_rotation: on</span><br />
|
||
<span class="f_CodeExample"> log_rotation_age: 1d</span><br />
|
||
<span class="f_CodeExample"> log_rotation_size: 0</span><br />
|
||
<span class="f_CodeExample"> log_line_prefix: '%t [%p-%l] %r %q%u@%d '</span><br />
|
||
<span class="f_CodeExample"> log_filename: 'postgresql-%a.log'</span><br />
|
||
<span class="f_CodeExample"> log_directory: /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/log/postgresql</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample"> initdb: # List options to be passed on to initdb</span><br />
|
||
<span class="f_CodeExample"> - encoding: UTF8</span><br />
|
||
<span class="f_CodeExample"> - locale: en_US.UTF-8</span><br />
|
||
<span class="f_CodeExample"> - data-checksums</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample"> pg_hba: # must contain addresses of ALL the machines used in the cluster</span><br />
|
||
<span class="f_CodeExample"> - local all postgres peer</span><br />
|
||
<span class="f_CodeExample"> - local all all peer</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"> - 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"> </span><br />
|
||
<span class="f_CodeExample">postgresql:</span><br />
|
||
<span class="f_CodeExample"> listen: 192.168.1.1,127.0.0.1:5432 # address of the node where the file is</span><br />
|
||
<span class="f_CodeExample"> connect_address: 192.168.1.1:5432 # address of the node where the file is</span><br />
|
||
<span class="f_CodeExample"> use_unix_socket: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> data_dir: /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/lib/postgresql/13/main # data directory</span><br />
|
||
<span class="f_CodeExample"> bin_dir: /usr/lib/postgresql/13/bin</span><br />
|
||
<span class="f_CodeExample"> config_dir: /etc/postgresql/13/main</span><br />
|
||
<span class="f_CodeExample"> pgpass: /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/lib/postgresql/.pgpass_patroni</span><br />
|
||
<span class="f_CodeExample"> authentication:</span><br />
|
||
<span class="f_CodeExample"> replication:</span><br />
|
||
<span class="f_CodeExample"> username: replicator</span><br />
|
||
<span class="f_CodeExample"> password: ReplicatorPassword</span><br />
|
||
<span class="f_CodeExample"> superuser:</span><br />
|
||
<span class="f_CodeExample"> username: postgres</span><br />
|
||
<span class="f_CodeExample"> password: PostgresPassword</span><br />
|
||
<span class="f_CodeExample"> parameters:</span><br />
|
||
<span class="f_CodeExample"> unix_socket_directories: /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/run/postgresql</span><br />
|
||
<span class="f_CodeExample"> pg_hba: # must contain addresses of ALL the machines used in the cluster</span><br />
|
||
<span class="f_CodeExample"> - local all postgres peer</span><br />
|
||
<span class="f_CodeExample"> - local all all peer</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"> - 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"> </span><br />
|
||
<span class="f_CodeExample"> remove_data_directory_on_rewind_failure: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> remove_data_directory_on_diverged_timelines: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample" style="font-weight: bold;"> </span><br />
|
||
<span class="f_CodeExample"> create_replica_methods:</span><br />
|
||
<span class="f_CodeExample"> - basebackup</span><br />
|
||
<span class="f_CodeExample"> basebackup:</span><br />
|
||
<span class="f_CodeExample"> max-rate: '100M'</span><br />
|
||
<span class="f_CodeExample"> checkpoint: 'fast'</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">watchdog:</span><br />
|
||
<span class="f_CodeExample"> mode: off # Allowed values: off, automatic, required</span><br />
|
||
<span class="f_CodeExample"> device: /dev/watchdog</span><br />
|
||
<span class="f_CodeExample"> safety_margin: 5</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">tags:</span><br />
|
||
<span class="f_CodeExample"> nofailover: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> noloadbalance: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> clonefrom: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> nosync: </span><span class="f_CodeExample" style="font-weight: bold;">false</span></p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<p class="p_Normal"><a class="dropdown-toggle" style="font-style: normal; font-weight: normal; color: #000000; background-color: transparent; text-decoration: none;" href="javascript:HMToggle('toggle','TOGGLE0186A5')">Example initial configuration to enable TLS/SSL support in Patroni</a></p>
|
||
<div id="TOGGLE0186A5" class="dropdown-toggle-body" style="text-align: left; text-indent: 0; line-height: 1.80; padding: 0 0 0 0; margin: 0 0 0 0;"><table style="border:none; border-spacing:0;">
|
||
<tr>
|
||
<td style="vertical-align:top; padding:0; border:none"><p class="p_Normal">Place the example initial configuration with TLS/SSL in the file <code><b>/etc/patroni/config.yml</b></code>. Pay attention to the comments in this file:</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">scope: postgres-cluster # the same value on all nodes</span><br />
|
||
<span class="f_CodeExample">name: postgresql-server1 # different values on all nodes</span><br />
|
||
<span class="f_CodeExample">namespace: /service/ # the same value on all nodes</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">restapi:</span><br />
|
||
<span class="f_CodeExample"> listen: postgres-server1.your_domain:8008 # address of the node where the file is</span><br />
|
||
<span class="f_CodeExample"> connect_address: postgres-server1.your_domain:8008 # address of the node where the file is</span><br />
|
||
<span class="f_CodeExample"> cafile: /path/to/pgCA.pem</span><br />
|
||
<span class="f_CodeExample"> certfile: /path/to/pg.crt # path to the server certificate file</span><br />
|
||
<span class="f_CodeExample"> keyfile: /path/to/pg.key # path to the private key file</span><br />
|
||
<span class="f_CodeExample"> verify_client: required # path to the root CA file</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">etcd:</span><br />
|
||
<span class="f_CodeExample"> protocol: https</span><br />
|
||
<span class="f_CodeExample"> cert: /path/to/</span><span class="f_CodeExample" style="font-weight: bold;">public</span><span class="f_CodeExample">.crt # path to the server certificate file</span><br />
|
||
<span class="f_CodeExample"> key: /path/to/</span><span class="f_CodeExample" style="font-weight: bold;">private</span><span class="f_CodeExample">.key # path to the private key file</span><br />
|
||
<span class="f_CodeExample"> cacert: /path/to/certCA.pem # path to the root CA file</span><br />
|
||
<span class="f_CodeExample"> hosts: postgres-server1.your_domain:2379,postgres-server2.your_domain:2379,postgres-server3.your_domain:2379 # list of all the nodes with installed etcd</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">ctl:</span><br />
|
||
<span class="f_CodeExample"> insecure: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><span class="f_CodeExample"> # Allow connections to SSL sites without certs</span><br />
|
||
<span class="f_CodeExample"> certfile: /path/to/pg.crt # path to the server certificate file</span><br />
|
||
<span class="f_CodeExample"> keyfile: /path/to/pg.key # path to the private key file</span><br />
|
||
<span class="f_CodeExample"> cacert: /path/to/pgCA.pem # path to the root CA file</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">bootstrap:</span><br />
|
||
<span class="f_CodeExample"> method: initdb</span><br />
|
||
<span class="f_CodeExample"> dcs:</span><br />
|
||
<span class="f_CodeExample"> ttl: 30</span><br />
|
||
<span class="f_CodeExample"> loop_wait: 10</span><br />
|
||
<span class="f_CodeExample"> retry_timeout: 10</span><br />
|
||
<span class="f_CodeExample"> maximum_lag_on_failover: 1048576</span><br />
|
||
<span class="f_CodeExample"> master_start_timeout: 300</span><br />
|
||
<span class="f_CodeExample"> synchronous_mode: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> synchronous_mode_strict: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> synchronous_node_count: 1</span><br />
|
||
<span class="f_CodeExample"> postgresql:</span><br />
|
||
<span class="f_CodeExample"> use_pg_rewind: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> use_slots: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> parameters:</span><br />
|
||
<span class="f_CodeExample"> max_connections: 2000</span><br />
|
||
<span class="f_CodeExample"> superuser_reserved_connections: 5</span><br />
|
||
<span class="f_CodeExample"> max_locks_per_transaction: 64</span><br />
|
||
<span class="f_CodeExample"> max_prepared_transactions: 0</span><br />
|
||
<span class="f_CodeExample"> huge_pages: </span><span class="f_CodeExample" style="font-weight: bold;">try</span><br />
|
||
<span class="f_CodeExample"> shared_buffers: 512MB</span><br />
|
||
<span class="f_CodeExample"> work_mem: 128MB</span><br />
|
||
<span class="f_CodeExample"> maintenance_work_mem: 256MB</span><br />
|
||
<span class="f_CodeExample"> effective_cache_size: 4GB</span><br />
|
||
<span class="f_CodeExample"> checkpoint_timeout: 15min</span><br />
|
||
<span class="f_CodeExample"> checkpoint_completion_target: 0.9</span><br />
|
||
<span class="f_CodeExample"> wal_compression: on</span><br />
|
||
<span class="f_CodeExample"> min_wal_size: 2GB</span><br />
|
||
<span class="f_CodeExample"> max_wal_size: 4GB</span><br />
|
||
<span class="f_CodeExample"> wal_buffers: 32MB</span><br />
|
||
<span class="f_CodeExample"> default_statistics_target: 1000</span><br />
|
||
<span class="f_CodeExample"> seq_page_cost: 1</span><br />
|
||
<span class="f_CodeExample"> random_page_cost: 4</span><br />
|
||
<span class="f_CodeExample"> effective_io_concurrency: 2</span><br />
|
||
<span class="f_CodeExample"> synchronous_commit: on</span><br />
|
||
<span class="f_CodeExample"> autovacuum: on</span><br />
|
||
<span class="f_CodeExample"> autovacuum_max_workers: 5</span><br />
|
||
<span class="f_CodeExample"> autovacuum_vacuum_scale_factor: 0.01</span><br />
|
||
<span class="f_CodeExample"> autovacuum_analyze_scale_factor: 0.02</span><br />
|
||
<span class="f_CodeExample"> autovacuum_vacuum_cost_limit: 200</span><br />
|
||
<span class="f_CodeExample"> autovacuum_vacuum_cost_delay: 20</span><br />
|
||
<span class="f_CodeExample"> autovacuum_naptime: 1s</span><br />
|
||
<span class="f_CodeExample"> max_files_per_process: 4096</span><br />
|
||
<span class="f_CodeExample"> archive_mode: on</span><br />
|
||
<span class="f_CodeExample"> archive_timeout: 1800s</span><br />
|
||
<span class="f_CodeExample"> archive_command: cd .</span><br />
|
||
<span class="f_CodeExample"> wal_level: replica</span><br />
|
||
<span class="f_CodeExample"> wal_keep_segments: 130</span><br />
|
||
<span class="f_CodeExample"> max_wal_senders: 10</span><br />
|
||
<span class="f_CodeExample"> max_replication_slots: 10</span><br />
|
||
<span class="f_CodeExample"> hot_standby: on</span><br />
|
||
<span class="f_CodeExample"> hot_standby_feedback: True</span><br />
|
||
<span class="f_CodeExample"> wal_log_hints: on</span><br />
|
||
<span class="f_CodeExample"> shared_preload_libraries: pg_stat_statements,auto_explain</span><br />
|
||
<span class="f_CodeExample"> pg_stat_statements.max: 10000</span><br />
|
||
<span class="f_CodeExample"> pg_stat_statements.track: all</span><br />
|
||
<span class="f_CodeExample"> pg_stat_statements.save: off</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_min_duration: 10s</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_analyze: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_buffers: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_timing: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_triggers: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_verbose: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> auto_explain.log_nested_statements: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> standard_conforming_strings: true</span><br />
|
||
<span class="f_CodeExample"> track_io_timing: on</span><br />
|
||
<span class="f_CodeExample"> log_lock_waits: on</span><br />
|
||
<span class="f_CodeExample"> log_temp_files: 3</span><br />
|
||
<span class="f_CodeExample"> track_activities: on</span><br />
|
||
<span class="f_CodeExample"> track_counts: on</span><br />
|
||
<span class="f_CodeExample"> track_functions: all</span><br />
|
||
<span class="f_CodeExample"> log_checkpoints: on</span><br />
|
||
<span class="f_CodeExample"> logging_collector: on</span><br />
|
||
<span class="f_CodeExample"> log_truncate_on_rotation: on</span><br />
|
||
<span class="f_CodeExample"> log_rotation_age: 1d</span><br />
|
||
<span class="f_CodeExample"> log_rotation_size: 0</span><br />
|
||
<span class="f_CodeExample"> log_line_prefix: '%t [%p-%l] %r %q%u@%d '</span><br />
|
||
<span class="f_CodeExample"> log_filename: 'postgresql-%a.log'</span><br />
|
||
<span class="f_CodeExample"> log_directory: /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/log/postgresql</span><br />
|
||
<span class="f_CodeExample"> ssl: on</span><br />
|
||
<span class="f_CodeExample"> ssl_ca_file: '/path/to/pgCA.pem'</span><br />
|
||
<span class="f_CodeExample"> ssl_cert_file: '/path/to/pg.crt'</span><br />
|
||
<span class="f_CodeExample"> ssl_key_file: '/path/to/pg.key'</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample"> initdb: # List options to be passed on to initdb</span><br />
|
||
<span class="f_CodeExample"> - encoding: UTF8</span><br />
|
||
<span class="f_CodeExample"> - locale: en_US.UTF-8</span><br />
|
||
<span class="f_CodeExample"> - data-checksums</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample"> pg_hba: # must contain addresses of ALL the machines used in the cluster</span><br />
|
||
<span class="f_CodeExample"> - local all postgres peer</span><br />
|
||
<span class="f_CodeExample"> - local all all peer</span><br />
|
||
<span class="f_CodeExample"> - hostssl all all 0.0.0.0/0 md5</span><br />
|
||
<span class="f_CodeExample"> - hostssl replication replicator localhost trust</span><br />
|
||
<span class="f_CodeExample"> - hostssl replication replicator 192.168.1.1/32 md5</span><br />
|
||
<span class="f_CodeExample"> - hostssl replication replicator 192.168.1.2/32 md5</span><br />
|
||
<span class="f_CodeExample"> - hostssl replication replicator 192.168.1.3/32 md5</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">postgresql:</span><br />
|
||
<span class="f_CodeExample"> listen: 192.168.1.1,127.0.0.1:5432 # address of the node where the file is</span><br />
|
||
<span class="f_CodeExample"> connect_address: 192.168.1.1:5432 # address of the node where the file is</span><br />
|
||
<span class="f_CodeExample"> use_unix_socket: </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||
<span class="f_CodeExample"> data_dir: /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/lib/postgresql/13/main # data directory</span><br />
|
||
<span class="f_CodeExample"> bin_dir: /usr/lib/postgresql/13/bin</span><br />
|
||
<span class="f_CodeExample"> config_dir: /etc/postgresql/13/main</span><br />
|
||
<span class="f_CodeExample"> pgpass: /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/lib/postgresql/.pgpass_patroni</span><br />
|
||
<span class="f_CodeExample"> authentication:</span><br />
|
||
<span class="f_CodeExample"> replication:</span><br />
|
||
<span class="f_CodeExample"> username: replicator</span><br />
|
||
<span class="f_CodeExample"> password: ReplicatorPassword</span><br />
|
||
<span class="f_CodeExample"> sslcert: /path/to/pg.crt # path to the server certificate file</span><br />
|
||
<span class="f_CodeExample"> sslkey: /path/to/pg.key # path to the private key file</span><br />
|
||
<span class="f_CodeExample"> sslrootcert: /path/to/pgCA.pem # path to the root CA file</span><br />
|
||
<span class="f_CodeExample"> superuser:</span><br />
|
||
<span class="f_CodeExample"> username: postgres</span><br />
|
||
<span class="f_CodeExample"> password: PostgresPassword</span><br />
|
||
<span class="f_CodeExample"> sslcert: /path/to/pg.crt # path to the server certificate file</span><br />
|
||
<span class="f_CodeExample"> sslkey: /path/to/pg.key # path to the private key file</span><br />
|
||
<span class="f_CodeExample"> sslrootcert: /path/to/pgCA.pem # path to the root CA file</span><br />
|
||
<span class="f_CodeExample"> parameters:</span><br />
|
||
<span class="f_CodeExample"> unix_socket_directories: /</span><span class="f_CodeExample" style="font-weight: bold;">var</span><span class="f_CodeExample">/run/postgresql</span><br />
|
||
<span class="f_CodeExample"> pg_hba: # must contain addresses of ALL the machines used in the cluster</span><br />
|
||
<span class="f_CodeExample"> - local all postgres peer</span><br />
|
||
<span class="f_CodeExample"> - local all all peer</span><br />
|
||
<span class="f_CodeExample"> - hostssl all all 0.0.0.0/0 md5</span><br />
|
||
<span class="f_CodeExample"> - hostssl replication replicator localhost trust</span><br />
|
||
<span class="f_CodeExample"> - hostssl replication replicator 192.168.1.1/32 md5</span><br />
|
||
<span class="f_CodeExample"> - hostssl replication replicator 192.168.1.2/32 md5</span><br />
|
||
<span class="f_CodeExample"> - hostssl replication replicator 192.168.1.3/32 md5</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample"> remove_data_directory_on_rewind_failure: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> remove_data_directory_on_diverged_timelines: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample" style="font-weight: bold;"> </span><br />
|
||
<span class="f_CodeExample"> create_replica_methods:</span><br />
|
||
<span class="f_CodeExample"> - basebackup</span><br />
|
||
<span class="f_CodeExample"> basebackup:</span><br />
|
||
<span class="f_CodeExample"> max-rate: '100M'</span><br />
|
||
<span class="f_CodeExample"> checkpoint: 'fast'</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">watchdog:</span><br />
|
||
<span class="f_CodeExample"> mode: off # Allowed values: off, automatic, required</span><br />
|
||
<span class="f_CodeExample"> device: /dev/watchdog</span><br />
|
||
<span class="f_CodeExample"> safety_margin: 5</span><br />
|
||
<span class="f_CodeExample"> </span><br />
|
||
<span class="f_CodeExample">tags:</span><br />
|
||
<span class="f_CodeExample"> nofailover: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> noloadbalance: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> clonefrom: </span><span class="f_CodeExample" style="font-weight: bold;">false</span><br />
|
||
<span class="f_CodeExample"> nosync: </span><span class="f_CodeExample" style="font-weight: bold;">false</span></p>
|
||
<p class="p_Normal">Make the <span style="font-weight: bold;">postgres</span> user the owner of the private key file <code><b>pg.key</b></code>:</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">Начало внимание</span></p>
|
||
<p class="p_Normal">The private key file <code><b>pg.key</b></code> specified in the section <code><b>postgresql</b></code> must have permissions of u=rw (0600) or less if it belongs to the PostgreSQL database user, or permissions of u=rw, g=r (0640) or less if it belongs to the root .</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">Конец внимание</span></p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo chown postgres:postgres -R /path/to/pg.key</span><br />
|
||
<span class="f_CodeExample">sudo chmod 600 /path/to/pg.key</span></p>
|
||
<p class="p_Normal">For more details on TLS/SSL configuration in Patroni, refer to the <a href="https://patroni.readthedocs.io/en/latest/yaml_configuration.html" target="_blank" class="weblink">official Patroni documentation</a>.</p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<ol style="list-style-type:upper-roman" start="3">
|
||
<li value="3" class="p_Normal">Make the <span style="font-weight: bold;">postgres</span> user the owner of the configuration directory:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo chown postgres:postgres -R /etc/patroni</span><br />
|
||
<span class="f_CodeExample">sudo chmod 700 /etc/patroni</span></p>
|
||
<h2 class="p_Heading2"><a id="preparation-postgresql-patroni" class="hmanchor"></a><span class="f_Heading2">Step 7: Prepare PostgreSQL+Patroni cluster</span></h2>
|
||
<ol style="list-style-type:upper-roman">
|
||
<li value="1" class="p_Normal">Start the Patroni service on the <span style="font-weight: bold;">postgres-server1.your_domain</span> node, and then on the nodes <span style="font-weight: bold;">postgres-server2.your_domain</span> and <span style="font-weight: bold;">postgres-server3.your_domain</span>:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl enable --now patroni.service</span></p>
|
||
<ol style="list-style-type:upper-roman" start="2">
|
||
<li value="2" class="p_Normal">Check the cluster status:</li></ol>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">patronictl -c /etc/patroni/config.yml list</span></p>
|
||
<h2 class="p_Heading2"><a id="prepare-pgbouncer" class="hmanchor"></a><span class="f_Heading2">Step 8: Prepare PGBouncer (optional)</span></h2>
|
||
<p class="p_Normal">PGBouncer is designed to manage a connection pool to PostgreSQL, minimizing the overhead associated with establishing new connections to PostgreSQL. For information on installing and configuring PGBouncer, refer to <a href="pgbouncer-installation.html" class="topiclink">Install PGBouncer</a>.</p>
|
||
<h2 class="p_Heading2"><a id="haproxy-configuration" class="hmanchor"></a><span class="f_Heading2">Step 9: Configure HAProxy (postgres block)</span></h2>
|
||
<p class="p_Normal">Configure a <a href="fail-safe-haproxy.html" class="topiclink">high availablility HAProxy</a> to handle requests to PostgreSQL and load balance between the nodes of the PostgreSQL cluster. For more details, refer to <a href="haproxy-postgresql.html" class="topiclink">Configure HAProxy for PostgreSQL</a>.</p>
|
||
<h2 class="p_Heading2"><a id="connecting-to-postgresql" class="hmanchor"></a><span class="f_Heading2">Step 10: Connecto to PostgreSQL</span></h2>
|
||
<p class="p_Normal">Connection string to connect to the PostgreSQL cluster:</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">psqlUrl: postgresql:</span><span class="f_CodeExample">//elma365:SecretPassword@haproxy-server.your_domain:5000/elma365?sslmode=disable</span></p>
|
||
<p class="p_Normal">Connection string to connect to the PostgreSQL cluster for read-only access:</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">psqlUrl: postgresql:</span><span class="f_CodeExample">//elma365:SecretPassword@haproxy-server.your_domain:5001/elma365?sslmode=disable</span></p>
|
||
<p class="p_Normal"><a class="dropdown-toggle" style="font-style: normal; font-weight: normal; color: #000000; background-color: transparent; text-decoration: none;" href="javascript:HMToggle('toggle','TOGGLE0186A6')">Connecting to the PostgreSQL cluster with TLS/SSL</a></p>
|
||
<div id="TOGGLE0186A6" class="dropdown-toggle-body" style="text-align: left; text-indent: 0; line-height: 1.80; padding: 0 0 0 0; margin: 0 0 0 0;"><table style="border:none; border-spacing:0;">
|
||
<tr>
|
||
<td style="vertical-align:top; padding:0; border:none"><p class="p_Normal">Connection string to connect to the PostgreSQL cluster with TLS/SS:</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">psqlUrl: postgresql:</span><span class="f_CodeExample">//elma365:SecretPassword@haproxy-server.your_domain:5000/elma365?sslmode=require</span></p>
|
||
<p class="p_Normal">Connection string to connect to the PostgreSQL cluster with TLS/SSL for read-only access:</p>
|
||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">psqlUrl: postgresql:</span><span class="f_CodeExample">//elma365:SecretPassword@haproxy-server.your_domain:5001/elma365?sslmode=require</span></p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<h2 class="p_Heading2"><span class="f_Heading2">Prepare a PostgreSQL database for restoration</span></h2>
|
||
<p class="p_Normal">If you need to restore a database from backup, first prepare the database for restoration. For more details, refer to the article <a href="postgresql.html#prepare-to-restore" class="topiclink">PostgreSQL</a>.</p>
|
||
|
||
<div class="bottom-nav">
|
||
|
||
<a id="prev-link" class="topic__navi_prev" href="configure-system.html">
|
||
<span class="bottom-nav__arrow bottom-nav__arrow--prev"></span> <span
|
||
class="bottom-nav__link">configure-system.html</span>
|
||
</a>
|
||
|
||
|
||
<a id="next-link" class="topic__navi_next" href="configure-hot-standby-postgresql.html">
|
||
<span class="bottom-nav__link">configure-hot-standby-postgresql.html</span> <span
|
||
class="bottom-nav__arrow bottom-nav__arrow--next"></span>
|
||
</a>
|
||
|
||
</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>
|
||
<aside class="article__sidebar" style="display:none">
|
||
<input type="checkbox" />
|
||
<div class="article__arrow"></div>
|
||
<div class="table-of-contents elma365-right" id="toc2Content">
|
||
<h3 class="h3-toc">In this topic</h3>
|
||
<nav id="toc2"></nav>
|
||
</div>
|
||
</aside>
|
||
</div>
|
||
</article>
|
||
</main>
|
||
<footer class="footer">
|
||
<div class="footer-container">
|
||
<div class="footer-mobile">
|
||
|
||
<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="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>
|
||
</div>
|
||
|
||
</footer>
|
||
<iframe name="hmnavigation" style="display:none!important"></iframe>
|
||
<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>
|
||
<script src="./google-search.js"></script>
|
||
<script src="./main.js"></script>
|
||
<script type="text/javascript">
|
||
HMInitToggle('TOGGLE0186A1','hm.type','dropdown','hm.state','0');
|
||
HMInitToggle('TOGGLE0186A2','hm.type','dropdown','hm.state','0');
|
||
HMInitToggle('TOGGLE0186A3','hm.type','dropdown','hm.state','0');
|
||
HMInitToggle('TOGGLE0186A4','hm.type','dropdown','hm.state','0');
|
||
HMInitToggle('TOGGLE0186A5','hm.type','dropdown','hm.state','0');
|
||
HMInitToggle('TOGGLE0186A6','hm.type','dropdown','hm.state','0');
|
||
</script>
|
||
</body>
|
||
|
||
</html>
|