Saturday 5 September 2020

Talk about pgcenter utility - what is it, how to use it, how to find problems related with postgresql performance

 

PgCenter It's well known that PostgreSQL has rich activity statistics that allow a better understanding of its internal processes. Top-like interface for viewing stats. System resource utilization (cpu, memory, storage, networking). PostgreSQL general utilization (connections, autovacuum, qps) Common admin tasks.

In particular, they help to track changes and detecting and predicting problems. At the same time, statistics also have weaknesses, such as a lack of built-in tools for working with statistics. The PostgreSQL community, however, offers a variety of tools that have a multitude of features that help to address this.


It provides a convenient interface for working with PostgreSQL statistics and an easy way for standard admin tasks, such as, dealing with configuration and logs.

I downloaded the rpm from https://github.com/lesovsky/pgcenter/releases


Usage

The same options as in the psql:

pgcenter -h 127.0.0.1 -p 5432 -U postgres -d dbname

pgcenter -U postgres dbname

pgcenter dbname

pgcenter --port 5432 --dbname postgres --no-password


Interface Overview

 




Troubleshoot 

 

load average? – check cpu/disks usage.

us – check queries/activity.

sy, si, hi – check system/kernel/hardware.

wa – check queries, disks activity.

mem/swap – revise shared_buffers/work_mem.

dirty/writeback – write activity, disks utilization.

 

rollbacks – check postgres and application logs for errors.

deadlocks – check postgres log, review pg_locks.

conflicts – check pg_stat_database_conflicts, raise delays, enable feedback.

temporary files – check logs, pg_stat_statements, work_mem (carefully).



Installation 

[root@oracleasm1 new]# tar xvf pgcenter_0.6.5_Linux_x86_64.tar.gz

COPYRIGHT

README.md

doc/Changelog

doc/examples.md

doc/images

doc/pgcenter-config-readme.md

doc/pgcenter-profile-readme.md

doc/pgcenter-record-readme.md

doc/pgcenter-report-readme.md

doc/pgcenter-top-readme.md

pgcenter

[root@oracleasm1 new]# ll

total 14936

-rw-rw-r-- 1   2000     2000     1656 May 17 12:45 COPYRIGHT

drwxr-xr-x 3 root   root         4096 Sep  5 13:23 doc

-rwxrwxr-x 1   2000     2000 10112136 May 17 12:45 pgcenter

-rw-rw-rw- 1 oracle oinstall  5159923 Sep  5 13:10 pgcenter_0.6.5_Linux_x86_64.tar.gz

-rw-rw-r-- 1   2000     2000     9440 May 17 12:45 README.md

 

 

 

[root@oracleasm1 new]# yum install pgcenter

Loaded plugins: aliases, changelog, kabi, presto, refresh-packagekit, security, tmprepo, verify, versionlock

Loading support for kernel ABI

Setting up Install Process

expectedbehavior_instrumental/signature                                                           |  819 B     00:00    

expectedbehavior_instrumental/signature                                                           |  951 B     00:04 ...

expectedbehavior_instrumental-source/signature                                                    |  819 B     00:00    

expectedbehavior_instrumental-source/signature                                                    |  951 B     00:00 ...

pganalyze_collector/signature                                                                     |  836 B     00:00    

pganalyze_collector/signature                                                                     | 2.9 kB     00:12 ...

https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6Server-i386/repodata/repomd.xml: [Errno 14] problem making ssl connection

Trying other mirror.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: pgdg10. Please verify its path and try again

You have new mail in /var/spool/mail/root

 

[root@oracleasm1 new]# yum clean all

[root@oracleasm1 new]# yum install pgcenter

 

Loaded plugins: aliases, changelog, kabi, presto, refresh-packagekit, security, tmprepo, verify, versionlock

Loading support for kernel ABI

Setting up Install Process

epel/metalink                                                                                     | 8.3 kB     00:01    

epel                                                                                              | 4.7 kB     00:00    

epel/primary_db                                                                                   | 5.1 MB     00:48    

expectedbehavior_instrumental/signature                                                           |  819 B     00:00    

expectedbehavior_instrumental/signature                                                           |  951 B     00:04 ...

expectedbehavior_instrumental/primary                                                             |  175 B     00:00    

expectedbehavior_instrumental-source/signature                                                    |  819 B     00:00    

expectedbehavior_instrumental-source/signature                                                    |  951 B     00:02 ...

expectedbehavior_instrumental-source/primary                                                      |  175 B     00:00    

pganalyze_collector/signature                                                                     |  836 B     00:00    

pganalyze_collector/signature                                                                     | 2.9 kB     00:01 ...

pganalyze_collector/primary_db                                                                    |  12 kB     00:00    

pgdg10                                                                                            | 3.7 kB     00:00    

pgdg10/primary_db                                                                                 | 172 kB     00:01    

pgdg11                                                                                            | 3.7 kB     00:00    

pgdg11/primary_db                                                                                 | 164 kB     00:01    

pgdg94                                                                                            | 3.7 kB     00:00    

pgdg94/primary_db                                                                                 | 304 kB     00:04    

pgdg95                                                                                            | 3.7 kB     00:00    

pgdg95/primary_db                                                                                 | 165 kB     00:02    

pgdg96                                                                                            | 3.7 kB     00:00    

pgdg96/primary_db                                                                                 | 182 kB     00:03    

public_ol6_UEK_latest                                                                             | 2.5 kB     00:00    

public_ol6_UEK_latest/primary_db                                                                  |  68 MB     01:22    

public_ol6_latest                                                                                 | 2.7 kB     00:00    

public_ol6_latest/primary_db                                                                      |  30 MB     00:38    

Resolving Dependencies

--> Running transaction check

---> Package pgcenter.i686 0:0.3.0-1.rhel6 will be installed

--> Processing Dependency: postgresql94-libs for package: pgcenter-0.3.0-1.rhel6.i686

--> Running transaction check

---> Package postgresql94-libs.i686 0:9.4.26-1PGDG.rhel6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

=========================================================================================================================

 Package                           Arch                 Version                             Repository              Size

=========================================================================================================================

Installing:

 pgcenter                          i686                 0.3.0-1.rhel6                       pgdg94                  37 k

Installing for dependencies:

 postgresql94-libs                 i686                 9.4.26-1PGDG.rhel6                  pgdg94                 208 k

 

Transaction Summary

=========================================================================================================================

Install       2 Package(s)

 

Total download size: 245 k

Installed size: 729 k

Is this ok [y/N]: y

Downloading Packages:

Setting up and reading Presto delta metadata

Processing delta metadata

Package(s) data still to download: 245 k

(1/2): pgcenter-0.3.0-1.rhel6.i686.rpm                                                            |  37 kB     00:00    

(2/2): postgresql94-libs-9.4.26-1PGDG.rhel6.i686.rpm                                              | 208 kB     00:04    

-------------------------------------------------------------------------------------------------------------------------

Total                                                                                     23 kB/s | 245 kB     00:10    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : postgresql94-libs-9.4.26-1PGDG.rhel6.i686                                                             1/2

  Installing : pgcenter-0.3.0-1.rhel6.i686                                                                           2/2

  Verifying  : postgresql94-libs-9.4.26-1PGDG.rhel6.i686                                                             1/2

  Verifying  : pgcenter-0.3.0-1.rhel6.i686                                                                           2/2

 

Installed:

  pgcenter.i686 0:0.3.0-1.rhel6                                                                                          

 

Dependency Installed:

  postgresql94-libs.i686 0:9.4.26-1PGDG.rhel6                                                                           

 

Complete!

You have new mail in /var/spool/mail/root

[root@oracleasm1 new]# 

 

           

           

[oracle@oracleasm1 ~]$ su - postgres

Password:

-bash-4.1$

 /usr/pgsql-9.6/bin/pgbench  -c8 -P 60 -T 3600 -U postgres postgres


Read more 

Configure Streaming Replication in PostgreSQL

All about Physical Replication and Log shipping in Postgres 

Streaming-Replication Sync and Async, benefits of streaming replication over Log-shipping

No comments:

Post a Comment