Skip to content

Commit

Permalink
DISTPG-665 Updated analyze new cluster step (#456)
Browse files Browse the repository at this point in the history
modified:   docs/major-upgrade.md
  • Loading branch information
nastena1606 authored Oct 31, 2023
1 parent 7ee03ce commit c8588a1
Showing 1 changed file with 18 additions and 75 deletions.
93 changes: 18 additions & 75 deletions docs/major-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,12 @@ The exact steps may differ depending on the package manager of your operating sy
$ sudo percona-release setup ppg-15
```


* Install Percona Distribution for PostgreSQL 15 package:

```{.bash data-prompt="$"}
$ sudo apt install percona-postgresql-15
```


* Install the components:

```{.bash data-prompt="$"}
$ sudo apt install percona-postgresql-15-repack \
percona-postgresql-15-pgaudit \
percona-pgbackrest \
percona-patroni \
percona-pgbadger \
percona-pgaudit15-set-user \
percona-pgbadger \
percona-postgresql-15-wal2json \
percona-pg-stat-monitor15 \
percona-postgresql-contrib
percona-haproxy
percona-pgpool2
percona-pg-gather
```

2. Stop the `postgresql` service.

```{.bash data-prompt="$"}
Expand Down Expand Up @@ -113,7 +93,7 @@ The exact steps may differ depending on the package manager of your operating sy
* Check the ability to upgrade Percona Distribution for PostgreSQL from 14 to 15:

```{.bash data-prompt="$"}
$ /usr/lib/postgresql/15/bin/pg_upgrade
$ /usr/lib/postgresql/15/bin/pg_upgrade \
--old-datadir=/var/lib/postgresql/14/main \
--new-datadir=/var/lib/postgresql/15/main \
--old-bindir=/usr/lib/postgresql/14/bin \
Expand Down Expand Up @@ -204,29 +184,22 @@ The exact steps may differ depending on the package manager of your operating sy
```
6. Run the `analyze_new_cluster.sh` script
6. After the upgrade, the Optimizer statistics are not transferred to the new cluster. Run the `vaccumdb` command to analyze the new cluster:
```{.bash data-prompt="$"}
$ tmp/analyze_new_cluster.sh
$ /usr/lib/postgresql/15/bin/vacuumdb --all --analyze-in-stages
```
7. Delete the old cluster's data files:
```{.bash data-prompt="$"}
$ ./delete_old_cluster.sh
$ sudo rm -rf /etc/postgresql/14/main
$ #Logout
$ exit
```
7. Delete Percona Distribution for PostgreSQL 14 packages and configuration files
* Remove packages
```{.bash data-prompt="$"}
$ sudo apt remove percona-postgresql-14* percona-pgbackrest percona-patroni percona-pg-stat-monitor14 percona-pgaudit14-set-user percona-pgbadger percona-pgbouncer percona-postgresql-14-wal2json
```
* Remove old files
```{.bash data-prompt="$"}
$ rm -rf /etc/postgresql/14/main
```
## On Red Hat Enterprise Linux and CentOS using `yum`
Expand All @@ -253,25 +226,6 @@ The exact steps may differ depending on the package manager of your operating sy
$ sudo yum install percona-postgresql15-server
```
* Install components:
```{.bash data-prompt="$"}
$ sudo yum install percona-pgaudit \
percona-pgbackrest \
percona-pg_repack15 \
percona-patroni \
percona-pg-stat-monitor15 \
percona-pgbadger \
percona-pgaudit15_set_user \
percona-pgbadger \
percona-wal2json15 \
percona-postgresql15-contrib
percona-haproxy
percona-pgpool-II-pg15
percona-pg_gather
```
2. Set up Percona Distribution for PostgreSQL 15 cluster
* Log is as the postgres user
Expand All @@ -293,14 +247,12 @@ The exact steps may differ depending on the package manager of your operating sy
$ /usr/pgsql-15/bin/initdb -D /var/lib/pgsql/15/data
```
3. Stop the `postgresql` 14 service
```{.bash data-prompt="$"}
$ systemctl stop postgresql-14
```
4. Run the database upgrade.
Expand Down Expand Up @@ -353,7 +305,7 @@ The exact steps may differ depending on the package manager of your operating sy
--new-bindir /usr/pgsql-15/bin \
--old-datadir /var/lib/pgsql/14/data \
--new-datadir /var/lib/pgsql/15/data \
--link
--link
```
The `--link` flag creates hard links to the files on the old version cluster so you don’t need to copy data.
Expand All @@ -373,7 +325,7 @@ The exact steps may differ depending on the package manager of your operating sy
```
7. Run the `analyze_new_cluster.sh` script
7. After the upgrade, the Optimizer statistics are not transferred to the new cluster. Run the `vaccumdb` command to analyze the new cluster:
* Log in as the postgres user
Expand All @@ -382,10 +334,10 @@ The exact steps may differ depending on the package manager of your operating sy
$ sudo su postgres
```
* Run the script
* Run the `vaccumdb` command
```{.bash data-prompt="$"}
$ ./analyze_new_cluster.sh
$ /usr/pgsql-15/bin/vacuumdb --all --analyze-in-stages
```
Expand All @@ -395,17 +347,8 @@ The exact steps may differ depending on the package manager of your operating sy
$ ./delete_old_cluster.sh
```
9. Delete Percona Distribution for PostgreSQL old data files
9. Delete Percona Distribution for PostgreSQL 14 packages
* Remove packages
```{.bash data-prompt="$"}
$ sudo yum -y remove percona-postgresql14*
```
* Remove old files
```{.bash data-prompt="$"}
$ rm -rf /var/lib/pgsql/14/data
```
```{.bash data-prompt="$"}
$ rm -rf /var/lib/pgsql/14/data
```

0 comments on commit c8588a1

Please sign in to comment.