Re: Monitoring Replication - Postgres 9.2

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Monitoring Replication - Postgres 9.2
Date: 2016-11-30 02:01:17
Message-ID: CANu8FiweGk3nO0znNdm3fUP+zAeN-u2Au4o=qhv8rB29p2rxEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 29, 2016 at 8:55 PM, John R Pierce <pierce(at)hogranch(dot)com> wrote:

> On 11/29/2016 5:40 PM, Patrick B wrote:
>
>>
>>
>> Can't I do it on the DB size? Using a trigger maybe? instead of using
>> Cron?
>>
>
> triggers are only called on database events like insert, update, select.
> even something like the pgagent scheduler thats frequently bundled with
> pgadmin uses cron to run its master time process, which checks to see if
> there are any pending pgagent jobs and invokes them.
>
>
>
> for a every-minute event, i wouldn't use cron, I would write a little
> script/application in something like perl or python, which keeps persistent
> connections open, samples your data, inserts it, and sleeps til the next
> minute then repeats. running it from cron would require multiple
> process forks every sample, which is fairly expensive.
>
>
>
>
>
> --
> john r pierce, recycling bits in santa cruz
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

*There is no reason you can't execute a cron job on production to a remote
db.*

*eg:contents of cron*/5 * * * * psql -U postgres -h 123.4.56.789 -d
remote_db_name -f /path_to/exec.sqlcontents of
exec.sql==========================INSERT INTO your_table SELECT now(),
client_addr, state, sent_location,
write_location, flush_location, replay_location,
sync_priority from pg_stat_replication;*--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2016-11-30 02:16:24 Re: Monitoring Replication - Postgres 9.2
Previous Message John R Pierce 2016-11-30 01:55:04 Re: Monitoring Replication - Postgres 9.2