Skip to content

Commit

Permalink
DISTPG-708 Added extra step to install Patroni on YUM (#495)
Browse files Browse the repository at this point in the history
DISTPG-712 Updated ETCD config steps

modified:   docs/solutions/ha-setup-apt.md
	modified:   docs/solutions/ha-setup-yum.md
	modified:   docs/yum.md
  • Loading branch information
nastena1606 authored Dec 12, 2023
1 parent 3080c77 commit 45f91e4
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 64 deletions.
64 changes: 34 additions & 30 deletions docs/solutions/ha-setup-apt.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ It's not necessary to have name resolution, but it makes the whole setup more re
1. Run the following command on each node. Change the node name to `node1`, `node2` and `node3` respectively:

```{.bash data-prompt="$"}
$ sudo hostnamectl set-hostname node-1
$ sudo hostnamectl set-hostname node1
```

2. Modify the `/etc/hosts` file of each PostgreSQL node to include the hostnames and IP addresses of the remaining nodes. Add the following at the end of the `/etc/hosts` file on all nodes:
Expand Down Expand Up @@ -159,7 +159,8 @@ The `etcd` cluster is first started in one node and then the subsequent nodes ar
3. Modify the `/etc/default/etcd` configuration file as follows:.
```text
```{.bash data-prompt="$"}
$ echo "
ETCD_NAME=${NODE_NAME}
ETCD_INITIAL_CLUSTER="${NODE_NAME}=http://${NODE_IP}:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
Expand All @@ -169,7 +170,7 @@ The `etcd` cluster is first started in one node and then the subsequent nodes ar
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
" | sudo tee -a /pg_ha/config/etcd.conf
```
3. Start the `etcd` service to apply the changes on `node1`.
Expand Down Expand Up @@ -207,24 +208,25 @@ The `etcd` cluster is first started in one node and then the subsequent nodes ar
ETCD_INITIAL_CLUSTER="node2=http://10.104.0.2:2380,node1=http://10.104.0.1:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
```
### Configure `node2`
1. Back up the configuration file and export environment variables as described in steps 1-2 of the [`node1` configuration](#configure-node1)
2. Edit the `/etc/default/etcd` configuration file on `node2`. Use the result of the `add` command on `node1` to change the configuration file as follows:
```text
ETCD_NAME=${NODE_NAME}
ETCD_INITIAL_CLUSTER="node-1=http://10.0.100.1:2380,node-2=http://10.0.100.2:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
```{.bash data-prompt="$"}
$ echo "
ETCD_NAME="node2"
ETCD_INITIAL_CLUSTER="node1=http://10.0.100.1:2380,node2=http://10.0.100.2:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
```
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
" | sudo tee -a /pg_ha/config/etcd.conf
```
3. Start the `etcd` service to apply the changes on `node2`:
Expand All @@ -245,19 +247,19 @@ The `etcd` cluster is first started in one node and then the subsequent nodes ar
2. On `node3`, back up the configuration file and export environment variables as described in steps 1-2 of the [`node1` configuration](#configure-node1)
3. Modify the `/etc/default/etcd` configuration file and add the output of the `add` command:
```text
ETCD_NAME=${NODE_NAME}
ETCD_INITIAL_CLUSTER="node1=http://10.104.0.1:2380,node2=http://10.104.0.2:2380,node3=http://10.104.0.3:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
```
```{.bash data-prompt="$"}
$ echo "
ETCD_NAME=node3
ETCD_INITIAL_CLUSTER="node1=http://10.104.0.1:2380,node2=http://10.104.0.2:2380,node3=http://10.104.0.3:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
" | sudo tee -a /pg_ha/config/etcd.conf
```
4. Start the `etcd` service on `node3`:
Expand Down Expand Up @@ -316,9 +318,10 @@ Run the following commands on all nodes. You can do this in parallel:
SCOPE="cluster_1
```
2. Create the `/etc/patroni/patroni.yml` configuration file and add the following configuration for `node1`:
2. Create the `/etc/patroni/patroni.yml` configuration file. Add the following configuration for `node1`:
```yaml title="/etc/patroni/patroni.yml"
```bash
echo "
namespace: ${NAMESPACE}
scope: ${SCOPE}
name: ${NODE_NAME}
Expand Down Expand Up @@ -403,6 +406,7 @@ Run the following commands on all nodes. You can do this in parallel:
noloadbalance: false
clonefrom: false
nosync: false
" | sudo tee -a /etc/patroni/patroni.yml
```
??? admonition "Patroni configuration file"
Expand Down
74 changes: 40 additions & 34 deletions docs/solutions/ha-setup-yum.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ It's not necessary to have name resolution, but it makes the whole setup more re
2. Install some Python and auxiliary packages to help with Patroni and ETCD
```{.bash data-prompt="$"}
$ sudo yum install python3-pip python3-dev binutils
$ sudo yum install python3-pip python3-devel binutils
```
3. Install ETCD, Patroni, pgBackRest packages:
3. Install ETCD, Patroni, pgBackRest packages. Check [platform specific notes for Patroni](../yum.md#for-percona-patroni-package):
```{.bash data-prompt="$"}
$ sudo yum install percona-patroni \
Expand Down Expand Up @@ -154,18 +154,19 @@ The `etcd` cluster is first started in one node and then the subsequent nodes ar
3. Modify the `/etc/etcd/etcd.conf` configuration file:
```text
ETCD_NAME=${NODE_NAME}
ETCD_INITIAL_CLUSTER="${NODE_NAME}=http://${NODE_IP}:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
```
```{.bash data-prompt="$"}
$ echo "
ETCD_NAME=${NODE_NAME}
ETCD_INITIAL_CLUSTER="${NODE_NAME}=http://${NODE_IP}:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
" | sudo tee -a /etc/etcd/etcd.conf
```
4. Start the `etcd` to apply the changes on `node1`:
Expand Down Expand Up @@ -208,16 +209,19 @@ The `etcd` cluster is first started in one node and then the subsequent nodes ar
1. Back up the configuration file and export environment variables as described in steps 1-2 of the [`node1` configuration](#configure-node1)
2. Edit the `/etc/etcd/etcd.conf` configuration file on `node2` and add the output from the `add` command:
```text
[Member]
ETCD_NAME=${NODE_NAME}
ETCD_INITIAL_CLUSTER="node-1=http://10.0.100.1:2380,node-2=http://10.0.100.2:2380"
ETCD_INITIAL_CLUSTER_STATE="existing" ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
```{.bash data-prompt="$"}
$ echo "
ETCD_NAME="node2"
ETCD_INITIAL_CLUSTER="node1=http://10.0.100.1:2380,node2=http://10.0.100.2:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
" | sudo tee -a /etc/etcd/etcd.conf
```
3. Start the `etcd` to apply the changes on `node2`:
Expand All @@ -239,19 +243,19 @@ The `etcd` cluster is first started in one node and then the subsequent nodes ar
2. On `node3`, back up the configuration file and export environment variables as described in steps 1-2 of the [`node1` configuration](#configure-node1)
3. Modify the `/etc/etcd/etcd.conf` configuration file on `node3` and add the output from the `add` command as follows:
```text
ETCD_NAME=${NODE_NAME}
ETCD_INITIAL_CLUSTER="node1=http://10.104.0.1:2380,node2=http://10.104.0.2:2380,node3=http://10.104.0.3:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
```
```{.bash data-prompt="$"}
$ echo "
ETCD_NAME=node3
ETCD_INITIAL_CLUSTER="node1=http://10.104.0.1:2380,node2=http://10.104.0.2:2380,node3=http://10.104.0.3:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_TOKEN}"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://${NODE_IP}:2380"
ETCD_DATA_DIR="${ETCD_DATA_DIR}"
ETCD_LISTEN_PEER_URLS="http://${NODE_IP}:2380"
ETCD_LISTEN_CLIENT_URLS="http://${NODE_IP}:2379,http://localhost:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://${NODE_IP}:2379"
" | sudo tee -a /etc/etcd/etcd.conf
```
3. Start the `etcd` service on `node3`:
Expand Down Expand Up @@ -327,9 +331,10 @@ Run the following commands on all nodes. You can do this in parallel:
$ sudo chmod 700 /data/pgsql
```
3. Create the `/etc/patroni/patroni.yml` with the following configuration:
3. Create the `/etc/patroni/patroni.yml` configuration file. Add the following configuration:
```yaml title="/etc/patroni/patroni.yml"
```bash
echo "
namespace: ${NAMESPACE}
scope: ${SCOPE}
name: ${NODE_NAME}
Expand Down Expand Up @@ -414,6 +419,7 @@ Run the following commands on all nodes. You can do this in parallel:
noloadbalance: false
clonefrom: false
nosync: false
" | sudo tee -a /etc/patroni/patroni.yml
```
4. Check that the systemd unit file `patroni.service` is created in `/etc/systemd/system`. If it is created, skip this step.
Expand Down
9 changes: 9 additions & 0 deletions docs/yum.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ You may need to install the `percona-postgresql{{pgversion}}-devel` package when
$ sudo dnf config-manager --set-enabled ol9_codeready_builder install perl-IPC-Run -y
```

<<<<<<< HEAD
=== "Rocky Linux 8"

```{.bash data-prompt="$"}
Expand All @@ -76,6 +77,14 @@ You may need to install the `percona-postgresql{{pgversion}}-devel` package when
$ sudo dnf config-manager --set-enabled ol9_codeready_builder install perl-IPC-Run -y
```

### For `percona-patroni` package

To install Patroni on Red Hat Enterprise Linux 9 and compatible derivatives, enable the `epel` repository

```{.bash data-prompt="$"}
$ sudo yum install epel-release
```

### For `pgpool2` extension

To install `pgpool2` on Red Hat Enterprise Linux and compatible derivatives, enable the codeready builder repository first to resolve dependencies conflict for `pgpool2`.
Expand Down

0 comments on commit 45f91e4

Please sign in to comment.