Skip to content

Commit 5cc3143

Browse files
committed
Added Troubleshoot Patroni startup options subsection
Fixed pgbackrest setup
1 parent 6b32bc0 commit 5cc3143

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

docs/solutions/ha-patroni.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,7 @@ Now it's time to start Patroni. You need the following commands on all nodes but
302302
$ sudo journalctl -fu percona-patroni
303303
```
304304

305-
A common error is Patroni complaining about the lack of proper entries in the `pg_hba.conf` file. If you see such errors, you must manually add or fix the entries in that file and then restart the service.
306-
307-
Changing the `patroni.yml` file and restarting the service will not have any effect here because the bootstrap section specifies the configuration to apply when PostgreSQL is first started in the node. It will not repeat the process even if the Patroni configuration file is modified and the service is restarted.
305+
See [Troubleshooting Patroni startup](#troubleshooting-patroni-startup) for guidelines in case of errors.
308306

309307
If Patroni has started properly, you should be able to locally connect to a PostgreSQL node using the following command:
310308

@@ -344,4 +342,26 @@ Now it's time to start Patroni. You need the following commands on all nodes but
344342
| node2 | 10.0.100.2 | Replica | streaming | 1 | 0 |
345343
| node3 | 10.0.100.3 | Replica | streaming | 1 | 0 |
346344
+--------+------------+---------+-----------+----+-----------+
347-
```
345+
```
346+
347+
### Troubleshooting Patroni startup
348+
349+
A common error is Patroni complaining about the lack of proper entries in the `pg_hba.conf` file. If you see such errors, you must manually add or fix the entries in that file and then restart the service.
350+
351+
An example of such an error is `No pg_hba.conf entry for replication connection from host to <IP>, user replicator, no encryption`. This means that Patroni cannot connect to the node you're adding to the cluster. To resolve this issue, add the IP addresses of the nodes to the `pg_hba:` section of the Patroni configuration file.
352+
353+
```
354+
pg_hba: # Add following lines to pg_hba.conf after running 'initdb'
355+
- host replication replicator 127.0.0.1/32 trust
356+
- host replication replicator 0.0.0.0/0 md5
357+
- host replication replicator 10.0.100.2/32 trust
358+
- host replication replicator 10.0.100.3/32 trust
359+
- host all all 0.0.0.0/0 md5
360+
- host all all ::0/0 md5
361+
recovery_conf:
362+
restore_command: cp /home/postgres/archived/%f %p
363+
```
364+
365+
For production use, we recommend adding nodes individually as the more secure way. However, if your network is secure and you trust it, you can add the whole network these nodes belong to as the trusted one to bypass passwords use during authentication. Then all nodes from this network can connect to Patroni cluster.
366+
367+
Changing the `patroni.yml` file and restarting the service will not have any effect here because the bootstrap section specifies the configuration to apply when PostgreSQL is first started in the node. It will not repeat the process even if the Patroni configuration file is modified and the service is restarted.

docs/solutions/pgbackrest.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Do the following steps on the `backup` node.
3535
1. Create environment variables to simplify the config file creation:
3636

3737
```{.bash data-prompt="$"}
38-
export SRV_NAME="bkp-srv"
38+
export SRV_NAME="backup"
3939
export NODE1_NAME="node1"
4040
export NODE2_NAME="node2"
4141
export NODE3_NAME="node3"
@@ -56,7 +56,7 @@ Do the following steps on the `backup` node.
5656

5757
3. The default `pgBackRest` configuration file location is `/etc/pgbackrest/pgbackrest.conf`, but some systems continue to use the old path, `/etc/pgbackrest.conf`, which remains a valid alternative. If the former is not present in your system, create the latter.
5858

59-
Access the file's parent directory (either `cd /etc/` or `cd /etc/pgbackrest/`), and make a backup copy of it:
59+
Go to the file's parent directory (either `cd /etc/` or `cd /etc/pgbackrest/`), and make a backup copy of it:
6060
6161
```{.bash data-prompt="$"}
6262
$ sudo cp pgbackrest.conf pgbackrest.conf.orig
@@ -92,7 +92,7 @@ Do the following steps on the `backup` node.
9292
repo1-retention-full=4
9393
9494
# Server general options
95-
process-max=12
95+
process-max=4 # This depends on the number of CPU resources your server has. The recommended value should equal or be less than the number of CPUs. While more processes can speed up backups, they will also consume additional system resources.
9696
log-level-console=info
9797
#log-level-file=debug
9898
log-level-file=info
@@ -174,7 +174,7 @@ Do the following steps on the `backup` node.
174174
repo1-retention-full=4
175175
176176
# Server general options
177-
process-max=12
177+
process-max=4 # This depends on the number of CPU resources your server has. The recommended value should equal or be less than the number of CPUs. While more processes can speed up backups, they will also consume additional system resources.
178178
log-level-console=info
179179
#log-level-file=debug
180180
log-level-file=info
@@ -340,7 +340,7 @@ Run the following commands on `node1`, `node2`, and `node3`.
340340
341341
```{.bash data-prompt="$"}
342342
$ export NODE_NAME=`hostname -f`
343-
$ export SRV_NAME="bkp-srv"
343+
$ export SRV_NAME="backup"
344344
$ export CA_PATH="/etc/ssl/certs/pg_ha"
345345
```
346346
@@ -379,7 +379,7 @@ Run the following commands on `node1`, `node2`, and `node3`.
379379
repo1-host-ca-file=${CA_PATH}/ca.crt
380380
381381
# general options
382-
process-max=16
382+
process-max=6
383383
log-level-console=info
384384
log-level-file=debug
385385
@@ -409,7 +409,7 @@ Run the following commands on `node1`, `node2`, and `node3`.
409409
repo1-host-ca-file=${CA_PATH}/ca.crt
410410
411411
# general options
412-
process-max=16
412+
process-max=6
413413
log-level-console=info
414414
log-level-file=debug
415415
@@ -508,7 +508,7 @@ Run the following commands on `node1`, `node2`, and `node3`.
508508
11. Reload the changed configurations. Provide the cluster name or the node name for the following command. In our example we use the `cluster_1` cluster name:
509509
510510
```{.bash data-prompt="$"}
511-
$ patronictl -c /etc/patroni/patroni.yml reload cluster_1
511+
$ patronictl -c /etc/patroni/patroni.yml restart cluster_1
512512
```
513513
514514
It may take a while to reload the new configuration.

0 commit comments

Comments
 (0)