- run pgCenter on the same host with Postgres, otherwise some features will not work, e.g. config editing, logfile view.
- run pgCenter using database
SUPERUSERaccount, e.g. postgres. Some kind of stats aren't available for unprivileged accounts. - Connections established to Postgres are managed by jackc/pgx driver which supports .pgpass and most of common libpq environment variables, such as PGHOST, PGPORT, PGUSER, PGDATABASE, PGPASSWORD, PGOPTIONS.
Download the latest release from release page and unpack, after that pgCenter is ready to run.
This way can be used to get develoment (unstable) version of pgCenter for development or testing purposes.
- Install a fresh version of
golanginto the system. Install it with package manager or download it directly from the official site. In this case after downloading you need to unpack the archive and copy binaries into the PATH. - Clone pgcenter's repo, switch to
devbranch.
git clone https://github.com/lesovsky/pgcenter
cd pgcenter
git checkout --track origin/dev
- Build
pgcenterusingMakefile. It supposesgobinary is already is in the PATH.
make
- Optionally you can install
pgcenterinto/usr/binusingMakefile. Root privileges required.
make install
Now pgcenter is ready for use.
docker build -t pgcenter .
docker run -it --rm pgcenter top -h 1.2.3.4 -U user -d production_db
pgCenter's functionality is splitted among several sub-comands, run specific one to achieve your goals. In most cases, connection setting can be omitted.
-
Run
topcommand to connect to Postgres and watching statistics:pgcenter top -h 1.2.3.4 -U postgres production_db -
Run
profilecommand to connect to Postgres and profile backend with PID 12345:pgcenter profile -U postgres -P 12345 production_db -
Run
profilecommand to profile backend with PID 12345 with frequency 50 (every 20ms):pgcenter profile -U postgres -P 12345 -F 50 production_db -
Run
recordcommand to connect to Postgres, poll statistics and continuously save to a local file:pgcenter record -f /tmp/stats.tar -U postgres production_db -
Run
reportcommand to read previously written file and build a report:pgcenter report -f /tmp/stats.tar --database -
Run
reportcommand, build activity report with start time 12:30:00 and end time 12:50:00:pgcenter report --activity --start 12:30:00 --end 12:50:00 -
Run
reportcommand, build tables report order byseq_scancolumn and show only 2 tables per snapshot:pgcenter report --tables --order seq_scan --limit 2 -
Run
reportcommand, build statements report and show statements that haveUPDATEword inquerycolumn:pgcenter report --statements m --grep query:UPDATE
Full list of available parameters available in a built-in help for particular command, use --help parameter.
pgcenter report --help