O'Reilly logo

Mastering PostgreSQL 10 by Hans-Jurgen Schonig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Checking replication to ensure availability

One of the core jobs of every administrator is to ensure that replication stays up and running all the time. If replication is down, it is possible that data could be lost if the master crashes. Therefore, keeping an eye on replication is absolutely necessary.

Fortunately, PostgreSQL provides system views, which allow you to take a deep look at what is going on. One of those views is pg_stat_replication:

test=# \d pg_stat_replication          View "pg_catalog.pg_stat_replication" Column            | Type                     | Modifiers-------------------+--------------------------+----------- pid               | integer                  | usesysid          | oid                      | usename           | name                     | application_name  | text                     | client_addr       | inet                     | client_hostname   | text                     | client_port | integer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required