Installation¶
Prerequisites¶
- PostgreSQL >= 9.4
- PostgreSQL contrib modules (pg_stat_statements and btree_gist)
- PostgreSQL server headers
On Debian, the PostgreSQL server headers are installed via the
postgresql-server-dev-X.Y
package:
apt-get install postgresql-server-dev-9.4 postgresql-contrib-9.4
On RPM-based distros:
yum install postgresql94-devel postgresql94-contrib
You also need a C compiler and other standard development tools.
On Debian, these can be installed via the build-essential
package:
apt-get install build-essential
On RPM-based distros, the “Development Tools” can be used:
yum groupinstall "Development Tools"
Installation¶
Grab the latest release, and install it:
wget https://github.com/powa-team/powa-archivist/archive/REL_4_0_0.tar.gz -O powa-archivist-REL_4_0_0.tar.gz tar zxvf powa-archivist-REL_4_0_0.tar.gz cd powa-archivist-REL_4_0_0
Compile and install it:
make
sudo make install
It should output something like the following :
/bin/mkdir -p '/usr/share/postgresql-9.4/extension'
/bin/mkdir -p '/usr/share/postgresql-9.4/extension'
/bin/mkdir -p '/usr/lib64/postgresql-9.4/lib64'
/bin/mkdir -p '/usr/share/doc/postgresql-9.4/extension'
/usr/bin/install -c -m 644 powa.control '/usr/share/postgresql-9.4/extension/'
/usr/bin/install -c -m 644 powa--2.0.sql '/usr/share/postgresql-9.4/extension/'
/usr/bin/install -c -m 644 README.md '/usr/share/doc/postgresql-9.4/extension/'
/usr/bin/install -c -m 755 powa.so '/usr/lib64/postgresql-9.4/lib64/'
Create the PoWA database and create the required extensions, with the following statements:
CREATE EXTENSION pg_stat_statements;
CREATE EXTENSION btree_gist;
CREATE EXTENSION powa;
Example:
bash-4.1$ psql
psql (9.3.5)
Type "help" for help.
postgres=# create database powa;
CREATE DATABASE
postgres=# \c powa
You are now connected to database "powa" as user "postgres".
powa=# create extension pg_stat_statements ;
CREATE EXTENSION
powa=# create extension btree_gist ;
CREATE EXTENSION
powa=# create extension powa;
CREATE EXTENSION
As PoWA-archivist is implemented as a background worker, the library must be loaded at server start time.
For this, modify the postgresql.conf
configuration file, and add powa and
pg_stat_statements to the shared_preload_libraries
parameter:
shared_preload_libraries = 'pg_stat_statements,powa'
If possible, activate track_io_timing
too:
track_io_timing = on
PostgreSQL should then be restarted.
Warning
Since PoWA 4, you need to specify powa in the shared_preload_libraries configuration ONLY if you want to store the performance data locally. For remote storage, please see the Remote setup documentation. The pg_stat_statements extension (as all other Stats Extensions) still required to be configured in the shared_preload_libraries setting.
If you’re setting up a repository database for a remote server, you can also entirely skip the pg_stat_statements configuration and the restart.