Skip to content

Commit

Permalink
DISTPG-665 Updated analyze new cluster step (#457)
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 0f1a620 commit 9dbd498
Showing 1 changed file with 25 additions and 99 deletions.
124 changes: 25 additions & 99 deletions docs/major-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,41 +56,12 @@ The exact steps may differ depending on the package manager of your operating sy
$ sudo percona-release setup ppg-14
```


* Install Percona Distribution for PostgreSQL 14 package:

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


* Install the components:

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

!!! admonition "See also"

Percona Documentation:


- [Percona Software Repositories Documentation](https://www.percona.com/doc/percona-repo-config/index.html)

- [Installing Percona Distribution for PostgreSQL](installing.md)


2. Stop the `postgresql` service.

```{.bash data-prompt="$"}
Expand Down Expand Up @@ -120,7 +91,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 13 to 14:

```{.bash data-prompt="$"}
$ /usr/lib/postgresql/14/bin/pg_upgrade
$ /usr/lib/postgresql/14/bin/pg_upgrade \
--old-datadir=/var/lib/postgresql/13/main \
--new-datadir=/var/lib/postgresql/14/main \
--old-bindir=/usr/lib/postgresql/13/bin \
Expand Down Expand Up @@ -159,8 +130,8 @@ The exact steps may differ depending on the package manager of your operating sy
$ /usr/lib/postgresql/14/bin/pg_upgrade
--old-datadir=/var/lib/postgresql/13/main \
--new-datadir=/var/lib/postgresql/14/main \
--old-bindir=/usr/lib/postgresql/13/bin \
--new-bindir=/usr/lib/postgresql/14/bin \
--old-bindir=/usr/lib/postgresql/13/bin \
--new-bindir=/usr/lib/postgresql/14/bin \
--old-options '-c config_file=/etc/postgresql/13/main/postgresql.conf' \
--new-options '-c config_file=/etc/postgresql/14/main/postgresql.conf' \
--link
Expand Down Expand Up @@ -211,29 +182,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/14/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/13/main
$ #Logout
$ exit
```
7. Delete Percona Distribution for PostgreSQL 13 packages and configuration files
* Remove packages
```{.bash data-prompt="$"}
$ sudo apt remove percona-postgresql-13* percona-pgbackrest percona-patroni percona-pg-stat-monitor13 percona-pgaudit13-set-user percona-pgbadger percona-pgbouncer percona-postgresql-13-wal2json
```
* Remove old files
```{.bash data-prompt="$"}
$ rm -rf /etc/postgresql/13/main
```
## On Red Hat Enterprise Linux and CentOS using `yum`
## On Red Hat Enterprise Linux and derivatives using `yum`
!!! important
Expand All @@ -256,34 +220,6 @@ The exact steps may differ depending on the package manager of your operating sy
$ sudo yum install percona-postgresql14-server
```
* Install components:
```{.bash data-prompt="$"}
$ sudo yum install percona-pgaudit \
percona-pgbackrest \
percona-pg_repack14 \
percona-patroni \
percona-pg-stat-monitor14 \
percona-pgbadger \
percona-pgaudit14_set_user \
percona-pgbadger \
percona-wal2json14 \
percona-postgresql14-contrib \
percona-pgpool-II-pg14 \
percona-pg_gather
```
!!! admonition "See also"
Percona Documentation:
* [Percona Software Repositories Documentation](https://www.percona.com/doc/percona-repo-config/index.html)
* [Installing Percona Distribution for PostgreSQL](#installing.md)
2. Set up Percona Distribution for PostgreSQL 14 cluster
* Log is as the postgres user
Expand All @@ -305,14 +241,12 @@ The exact steps may differ depending on the package manager of your operating sy
$ /usr/pgsql-14/bin/initdb -D /var/lib/pgsql/14/data
```
3. Stop the `postgresql` 13 service
```{.bash data-prompt="$"}
$ systemctl stop postgresql-13
```
4. Run the database upgrade.
Expand All @@ -331,7 +265,7 @@ The exact steps may differ depending on the package manager of your operating sy
--new-bindir /usr/pgsql-14/bin \
--old-datadir /var/lib/pgsql/13/data \
--new-datadir /var/lib/pgsql/14/data \
--link --check
--check
```
The `--check` flag here instructs `pg_upgrade` to only check the upgrade without changing any data.
Expand Down Expand Up @@ -365,7 +299,7 @@ The exact steps may differ depending on the package manager of your operating sy
--new-bindir /usr/pgsql-14/bin \
--old-datadir /var/lib/pgsql/13/data \
--new-datadir /var/lib/pgsql/14/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 @@ -378,14 +312,14 @@ The exact steps may differ depending on the package manager of your operating sy
$ systemctl start postgresql-14
```
6. Check postgresql status
6. Check `postgresql` status
```{.bash data-prompt="$"}
$ systemctl status postgresql-14
```
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 @@ -394,10 +328,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-14/bin/vacuumdb --all --analyze-in-stages
```
Expand All @@ -408,16 +342,8 @@ The exact steps may differ depending on the package manager of your operating sy
```
9. Delete Percona Distribution for PostgreSQL 13 packages
* Remove packages
```{.bash data-prompt="$"}
$ sudo yum -y remove percona-postgresql13*
```
* Remove old files
```{.bash data-prompt="$"}
$ rm -rf /var/lib/pgsql/13/data
```
9. Delete Percona Distribution old data files
```{.bash data-prompt="$"}
$ rm -rf /var/lib/pgsql/13/data
```

0 comments on commit 9dbd498

Please sign in to comment.