Skip to content

Commit 3032541

Browse files
authored
DISTPG-897 Documented install from tarball steps for PG server (#560)
* DISTPG-897 Documented install from tarball steps for PG server * Added how to run extensions, extended the Enable extensions page
1 parent 84bfd81 commit 3032541

File tree

6 files changed

+287
-7
lines changed

6 files changed

+287
-7
lines changed

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11.1

docs/enable-extensions.md

+67-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Enable Percona Distribution for PostgreSQL extensions
1+
# Enable Percona Distribution for PostgreSQL components
22

3-
Some extensions require additional configuration before using them with Percona Distribution for PostgreSQL. This sections provides configuration instructions per extension.
3+
Some components require additional configuration before using them with Percona Distribution for PostgreSQL. This sections provides configuration instructions per component.
44

5-
**Patroni**
5+
## Patroni
66

77
Patroni is the third-party high availability solution for PostgreSQL. The [High Availability in PostgreSQL with Patroni](solutions/high-availability.md) chapter provides details about the solution overview and architecture deployment.
88

@@ -25,7 +25,7 @@ See the configuration guidelines for [Debian and Ubuntu](solutions/ha-setup-apt.
2525

2626
- [PostgreSQL HA with Patroni: Your Turn to Test Failure Scenarios :octicons-link-external-16:](https://www.percona.com/blog/2021/06/11/postgresql-ha-with-patroni-your-turn-to-test-failure-scenarios/)
2727
28-
**pgBadger**
28+
## pgBadger
2929

3030
Enable the following options in `postgresql.conf` configuration file before starting the service:
3131

@@ -43,7 +43,31 @@ log_error_verbosity = default
4343

4444
For details about each option, see [pdBadger documentation :octicons-link-external-16:](https://github.com/darold/pgbadger/#POSTGRESQL-CONFIGURATION).
4545

46-
**pgAudit set-user**
46+
## pgaudit
47+
48+
Add the `pgaudit` to `shared_preload_libraries` in `postgresql.conf`. The recommended way is to use the [ALTER SYSTEM](https://www.postgresql.org/docs/16/sql-altersystem.html) command. [Connect to psql](#connect-to-the-postgresql-server) and use the following command:
49+
50+
```sql
51+
ALTER SYSTEM SET shared_preload_libraries = 'pgaudit';
52+
```
53+
54+
Start / restart the server to apply the configuration.
55+
56+
To configure `pgaudit`, you must have the privileges of a superuser. You can specify the settings in one of these ways:
57+
58+
* globally (in postgresql.conf or using ALTER SYSTEM ... SET),
59+
* at the database level (using ALTER DATABASE ... SET),
60+
* at the role level (using ALTER ROLE ... SET). Note that settings are not inherited through normal role inheritance and SET ROLE will not alter a user's pgAudit settings. This is a limitation of the roles system and not inherent to pgAudit.
61+
62+
Refer to the [pgaudit documentation](https://github.com/pgaudit/pgaudit/blob/master/README.md#settings) for details about available settings.
63+
64+
To enable `pgaudit`, connect to psql and run the CREATE EXTENSION command:
65+
66+
```sql
67+
CREATE EXTENSION pgaudit;
68+
```
69+
70+
## pgaudit set-user
4771

4872
Add the `set-user` to `shared_preload_libraries` in `postgresql.conf`. The recommended way is to use the [ALTER SYSTEM :octicons-link-external-16:](https://www.postgresql.org/docs/16/sql-altersystem.html) command. [Connect to psql](connect.md) and use the following command:
4973

@@ -53,16 +77,52 @@ ALTER SYSTEM SET shared_preload_libraries = 'set-user';
5377

5478
Start / restart the server to apply the configuration.
5579

80+
Install the extension into your database:
81+
82+
```sql
83+
psql <database>
84+
CREATE EXTENSION set_user;
85+
```
86+
5687
You can fine-tune user behavior with the [custom parameters :octicons-link-external-16:](https://github.com/pgaudit/set_user#configuration-options) supplied with the extension.
5788

58-
**wal2json**
89+
## pgbouncer
90+
91+
`pgbouncer` requires the `pgbouncer.ini` configuration file to start. The default path is `/etc/pgbouncer/pgbouncer.ini`. When installing `pgbouncer` from a [tarball](tarball.md), the path is `percona-pgbouncer/etc/pgbouncer.ini`.
92+
93+
Find detailed information about configuration file options in the [`pgbouncer documentation`](https://www.pgbouncer.org/config.html).
94+
95+
## pgpool2
96+
97+
`pgpool-II` requires the configuration file to start. When you install pgpool from a package, the configuration file is automatically created for you at the path `/etc/pgpool2/pgpool.conf` on Debian and Ubuntu and `/etc/pgpool-II/pgpool.conf` on RHEL and derivatives.
98+
99+
When you installed pgpool from tarballs, you can use the sample configuration file `<tarballsdir>/percona-pgpool-II/etc/pgpool2/pgpool.conf.sample`:
100+
101+
```{.bash data-prompt="$"}
102+
$ cp <tarballsdir>/percona-pgpool-II/etc/pgpool2/pgpool.conf.sample <config-gile-path>/pgpool.conf
103+
```
104+
105+
Specify the path to it when starting pgpool:
106+
107+
```{.bash data-prompt="$"}
108+
$ pgpool -f <config-gile-path>/pgpool.conf
109+
```
110+
111+
## pg_stat_monitor
112+
113+
Please refer to [`pg_stat_monitor`](pg-stat-monitor.md#setup) for setup steps.
114+
115+
## wal2json
59116

60117
After the installation, enable the following option in `postgresql.conf` configuration file before starting the service:
61118

62119
```
63120
wal_level = logical
64121
```
65122

123+
Start / restart the server to apply the changes.
124+
66125
## Next steps
67126

68-
[Connect to PostgreSQL :material-arrow-right:](connect.md){.md-button}
127+
[Connect to PostgreSQL :material-arrow-right:](connect.md){.md-button}
128+

docs/index.md

+29
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,34 @@ Learn about the releases and changes in the Distribution.
4949
</div>
5050
</div>
5151

52+
* [Patroni](https://patroni.readthedocs.io/en/latest/) is an HA (High Availability) solution for PostgreSQL.
53+
54+
* [pgaudit](https://www.pgaudit.org/) provides detailed session or object
55+
audit logging via the standard PostgreSQL logging facility
56+
57+
* [pgaudit set_user](https://github.com/pgaudit/set_user) - The `set_user` part of `pgAudit` extension provides an additional layer of logging and control when unprivileged users must escalate themselves to superuser or object owner roles in order to perform needed maintenance tasks.
58+
59+
* [pgBackRest](https://pgbackrest.org/) is a backup and restore solution for
60+
PostgreSQL
61+
62+
* [pgBadger](https://github.com/darold/pgbadger) - a fast PostgreSQL Log Analyzer.
63+
64+
* [PgBouncer](https://www.pgbouncer.org/) - a lightweight connection pooler for PostgreSQL
65+
66+
* [pg_gather](https://github.com/jobinau/pg_gather) - an SQL script to assess the health of PostgreSQL cluster by gathering performance and configuration data from PostgreSQL databases.
67+
68+
* [pgpool2](https://www.pgpool.net/mediawiki/index.php/Main_Page) - a middleware between PostgreSQL server and client for high availability, connection pooling and load balancing.
69+
70+
* [pg_repack](https://github.com/reorg/pg_repack) rebuilds
71+
PostgreSQL database objects
72+
73+
* [pg_stat_monitor](https://github.com/percona/pg_stat_monitor) collects and aggregates statistics for PostgreSQL and provides histogram information.
74+
75+
* [PostGIS](http://postgis.net/) allows storing and manipulating spacial data in PostgreSQL.
76+
77+
* [wal2json](https://github.com/eulerto/wal2json) - a PostgreSQL logical decoding JSON output plugin.
78+
79+
* A collection of [additional PostgreSQL contrib extensions](https://www.postgresql.org/docs/{{pgversion}}/contrib.html)
80+
5281

5382

docs/tarball.md

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Install Percona Distribiution for PostgreSQL from binary tarballs
2+
3+
You can find the binary tarballs on the [Percona website](https://www.percona.com/downloads). Select the desired version from a version dropdown and _All_ from the Select Platform dropdown.
4+
5+
There are the following tarballs available:
6+
7+
* percona-postgresql-{{dockertag}}-ssl1.1-linux-x86_64.tar.gz - for operating systems that run OpenSSL version 1.x
8+
* percona-postgresql-{{dockertag}}-ssl3-linux-x86_64.tar.gz - for for operating systems that run OpenSSL version 3.x
9+
10+
To check what OpenSSL version you have, run the following command:
11+
12+
```{.bash data-prompt="$"}
13+
$ openssl version
14+
```
15+
16+
## Tarball contents
17+
18+
The tarballs include the following components:
19+
20+
| Component | Description |
21+
|-----------|-------------|
22+
| percona-postgresql{{pgversion}}| The latest version of PostgreSQL server and the following extensions: <br> - `pgaudit` <br> - `pgAudit_set_user` <br> - `pg_repack` <br> - `pg_stat_monitor` <br> - `pg_gather` <br> - `wal2json` <br> - the set of [contrib extensions](contrib.md)|
23+
| percona-haproxy | A high-availability solution and load-balancing solution |
24+
| percona-patroni | A high-availability solution for PostgreSQL |
25+
| percona-pgbackrest| A backup and restore tool |
26+
| percona-pgbadger| PostgreSQL log analyzer with fully detailed reports and graphs |
27+
| percona-pgbouncer| Lightweight connection pooler for PostgreSQL |
28+
| percona-pgpool-II| A middleware between PostgreSQL server and client for high availability, connection pooling and load balancing |
29+
| percona-perl | A Perl module required to create the `plperl` extension - a procedural language handler for PostgreSQL that allows writing functions in the Perl programming language|
30+
| percona-python3 | A Python3 module required to create `plpython` extension - a procedural language handler for PostgreSQL that allows writing functions in the Python programming language. Python is also required by Patroni
31+
| percona-tcl | Tcl development libraries required to create the `pltcl` extension - a loadable procedural language for the PostgreSQL database system that enables the creation of functions and trigger procedures in the Tcl language |
32+
| percona-etcd | A key-value distributed store that stores the state of the PostgreSQL cluster|
33+
34+
## Preconditions
35+
36+
=== "Debian and Ubuntu"
37+
38+
1. Uninstall the upstream PostgreSQL package.
39+
2. Create the user to own the PostgreSQL process. For example, `mypguser`. Run the following command:
40+
41+
```{.bash data-prompt="$"}
42+
$ sudo useradd -m mypguser
43+
```
44+
45+
Set the password for the user:
46+
47+
```{.bash data-prompt="$"}
48+
$ sudo passwd mypguser
49+
```
50+
51+
=== "RHEL and derivatives"
52+
53+
Create the user to own the PostgreSQL process. For example, `mypguser`, Run the following command:
54+
55+
```{.bash data-prompt="$"}
56+
$ sudo useradd mypguser -m
57+
```
58+
59+
Set the password for the user:
60+
61+
```{.bash data-prompt="$"}
62+
$ sudo passwd mypguser
63+
```
64+
65+
## Procedure
66+
67+
The steps below install the tarballs for OpenSSL 3.x. Use another tarball if your operating system has OpenSSL version 1.x.
68+
69+
1. Create the directory where you will store the binaries. For example, `/opt/pgdistro`
70+
71+
2. Grant access to this directory for the `mypguser` user.
72+
73+
```{.bash data-prompt="$"}
74+
$ sudo chown mypguser:mypguser /opt/pgdistro/
75+
```
76+
77+
3. Fetch the binary tarball:
78+
79+
```{.bash data-prompt="$"}
80+
$ wget https://downloads.percona.com/downloads/postgresql-distribution-16/{{dockertag}}/binary/tarball/percona-postgresql-{{dockertag}}-ssl3-linux-x86_64.tar.gz
81+
```
82+
83+
4. Extract the tarball to the directory for binaries that you created on step 1.
84+
85+
```{.bash data-prompt="$"}
86+
$ sudo tar -xfv percona-postgresql-{{dockertag}}-ssl3-linux-x86_64.tar.gz -C /opt/pgdistro/
87+
```
88+
89+
5. If you extracted the tarball in a directory other than `/opt`, copy `percona-python3`, `percona-tcl` and `percona-perl` to the `/opt` directory. This is required for the correct run of libraries that require those modules.
90+
91+
```{.bash data-prompt="$"}
92+
$ sudo cp <path_to>/percona-perl <path_to>/percona-python3 <path_to>/percona-tcl /opt/
93+
```
94+
95+
6. Add the location of the binaries to the PATH variable:
96+
97+
```{.bash data-prompt="$"}
98+
$ export PATH=:/opt/pgdistro/percona-haproxy/sbin/:/opt/pgdistro/percona-patroni/bin/:/opt/pgdistro/percona-pgbackrest/bin/:/opt/pgdistro/percona-pgbadger/:/opt/pgdistro/percona-pgbouncer/bin/:/opt/pgdistro/percona-pgpool-II/bin/:/opt/pgdistro/percona-postgresql{{pgversion}}/bin/:/opt/pgdistro/percona-etcd/bin/:/opt/percona-perl/bin/:/opt/percona-tcl/bin/:/opt/percona-python3/bin/:$PATH
99+
```
100+
101+
6. Create the data directory for PostgreSQL server. For example, `/usr/local/pgsql/data`.
102+
7. Grant access to this directory for the `mypguser` user.
103+
104+
```{.bash data-prompt="$"}
105+
$ sudo chown mypguser:mypguser /usr/local/pgsql/data
106+
```
107+
108+
8. Switch to the user that owns the Postgres process. In our example, `mypguser`:
109+
110+
```{.bash data-prompt="$"}
111+
$ su - mypguser
112+
```
113+
114+
9. Initiate the PostgreSQL data directory:
115+
116+
```{.bash data-prompt="$"}
117+
$ /opt/pgdistro/percona-postgresql{{pgversion}}/bin/initdb -D /usr/local/pgsql/data
118+
```
119+
120+
121+
??? example "Sample output"
122+
123+
```{.text .no-copy}
124+
Success. You can now start the database server using:
125+
126+
/opt/pgdistro/percona-postgresql{{pgversion}}/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
127+
```
128+
129+
10. Start the PostgreSQL server:
130+
131+
```{.bash data-prompt="$"}
132+
$ /opt/pgdistro/percona-postgresql{{pgversion}}/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
133+
```
134+
135+
??? example "Sample output"
136+
137+
```{.text .no-copy}
138+
waiting for server to start.... done
139+
server started
140+
```
141+
142+
9. Connect to `psql`
143+
144+
```{.bash data-prompt="$"}
145+
$ /opt/pgdistro/percona-postgresql{{pgversion}}/bin/psql
146+
```
147+
148+
??? example "Sample output"
149+
150+
```{.text .no-copy}
151+
psql ({{dockertag}})
152+
Type "help" for help.
153+
154+
postgres=#
155+
```
156+
157+
### Start the components
158+
159+
After you unpacked the tarball and added the location of the components' binaries to the $PATH variable, the components are available for use. You can invoke a component by running its command-line tool. For example, to check HAProxy version, type:
160+
161+
```{.bash data-prompt="$"}
162+
$ haproxy version
163+
```
164+
165+
Some components require additional setup. Check the [Enabling extensions](enable-extensions.md) page for details.

docs/uninstalling.md

+23
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,26 @@ To uninstall Percona Distribution for PostgreSQL, remove all the installed packa
6060
```{.bash data-prompt="$"}
6161
$ rm -rf /var/lib/pgsql/16/data
6262
```
63+
64+
## Uninstall from tarballs
65+
66+
If you [installed Percona Distribution for PostgreSQL from binary tarballs](tarball.md), stop the PostgreSQL server and remove the folder with the binary tarballs.
67+
68+
1. Stop the `postgres` server:
69+
70+
```{.bash data-prompt="$"}
71+
$ /path/to/tarballs/percona-postgresql{{pgversion}}/bin/pg_ctl -D path/to/datadir -l logfile stop
72+
```
73+
74+
??? example "Sample output"
75+
76+
```{.text .no-copy}
77+
waiting for server to shut down.... done
78+
server stopped
79+
```
80+
81+
2. Remove the directory with extracted tarballs
82+
83+
```{.bash data-prompt="$"}
84+
$ sudo rm -rf /path/to/tarballs/
85+
```

mkdocs-base.yml

+2
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,13 @@ extra:
152152

153153
nav:
154154
- 'Home': 'index.md'
155+
155156
- Get started:
156157
- Quickstart guide: installing.md
157158
- 1. Install:
158159
- Via apt: apt.md
159160
- Via yum: yum.md
161+
- From tarballs: tarball.md
160162
- Run in Docker: docker.md
161163
- enable-extensions.md
162164
- repo-overview.md

0 commit comments

Comments
 (0)