case studies on postgresql

18
© 2014 EnterpriseDB Corporation. All rights reserved. 1 Technical Case Studies in PostgreSQL [ Monitoring Methods ] Rohit Vyas | 11.04.15 Quality Management Group (PostgreSQL Installer and Tools)

Upload: inmobi-technology

Post on 05-Aug-2015

111 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 1

Technical Case Studies in PostgreSQL[ Monitoring Methods ]

Rohit Vyas | 11.04.15

Quality Management Group (PostgreSQL Installer and Tools)

Page 2: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 2

• Technical cases in PostgreSQL

• Database Monitoring Methods

Agenda

Page 3: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 3

− Bloats− Updates/Deletes cause bloats in a table in

PostgreSQL.

− Transaction Wraparound− No new XID’s if 4 billion mark reached.

− Streaming/WAL Replication Lag− Number of bytes lag from Master database may

be due to bulk load, network etc.,

− Handling WAL Archiving Files− Piling up .ready files due to failure of archiver

process

− Catalog Corruption− Database objects repository(pg_catalog schema)

corruption.

Technical Cases on Production Database

ERROR: database is not accepting commands to avoid

wraparound data loss in database "dvnspatial"

Hint: Stop the postmaster and use a standalone

backend to vacuum that database.

You might also need to commit or roll back old prepared

transactions.

Error executing update (updateorg.matter.security.User)

PANIC: could not write to file

“pg_xlog/xlogtemp.556” :No space left on

device

notice: pg_class row has invalid relnamespace "24580":

no matching entry in pg_namespace

row identity: oid="24581" relname="foo" relkind="r"

Page 4: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 4

• Using pg_catalog Tables/Views/Functions

• Wrapping pg_catalog in Shell or any scripting language.

• Using open source tools − check_postgres.pl, pg_catcheck, pg_cluu, munin, Nagios etc

• Proprietary Tools − EnterpriseDB Postgres Enterprise Manager

Database Monitoring Methods

Page 5: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 5

• Tables− pg_class

− pg_database

• Views− pg_stat_activity

− pg_stat_all_tables

− pg_stat_archiver

− pg_stat_replication

• Functions− pg_is_in_recovery()

− pg_last_xlog_replay_location()

− pg_last_xact_replay_timestamp()

− pg_xlog_location_diff()

Using pg_catalogs

Page 6: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 6

Wrapping pg_catalogs in Shell or Other languages

Max Connections

Long Running queries

Idle Connections

Waiting Connections

Page 7: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 7

• check_postgres.pl

• pg_catcheck [ catalog corruption ]

• pg_cluu

Using open source tools

Page 8: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 8

Sample output of critical probes on Production Environment

Page 9: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 9

pg_catcheck

Page 10: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 10

Monitoring with Proprietary Tools

• Postgres Enterprise Manager [ EnterpriseDB] PostgreSQL

Instances of different versions

9.0.x

9.1.x9.4.x

9.3.x

9.2.x

PEM

Server

Page 11: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 11

PEM Probes And Alerts

Table Bloat Total table bloat in server

Highest Table Bloat in server

Table Frozen XID Table FrozenXID

Database Frozen XID Database FrozenXID

Number of WAL Files Number of WAL Files

WAL Archive status Number of WAL archiving Pending

Streaming Replication Standby server lag behind the master By WAL

segment

Standby server lag behind the master by WAL

pages

Streaming Replication Lag Number of minutes lag in standby server from

master server

Page 12: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 12

Dashboard's Charts

Page 13: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 13

PEM Alerts

Page 14: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 14

• Complete point and click management of all database objects

• 225+ pre-configured database alerts for immediate global at-a-glance monitoring complete with SMTP notifications, SNMP traps and richly configurable notification rules (New)

• Remote Monitoring (New)

• A Capacity Planning and Forecast Manager

• PostgreSQL Expert database configuration recommendations and deployment

• Log Management and a Log Analysis Expert (New)

• Team Management

• Custom probes for gathering metrics (New)

• SQL Profiler

• Index Advisor

• All optimized for working with multiple databases consistently across the enterprise.

Primary Product Features

Page 15: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 15

• On Premise Server

• Public Cloud [AWS]

• Private Cloud [Open stack ]

Deployment

Page 16: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 16

References

• http://www.enterprisedb.com/products-services-training/products/postgres-enterprise-manager

Postgres Enterprise Manager

Page 17: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 17

Questions?

Page 18: Case Studies on PostgreSQL

© 2014 EnterpriseDB Corporation. All rights reserved. 18