Re: Problemas con el pg_cron

From: Mario González Troncoso <gonzalemario(at)gmail(dot)com>
To: Fernando Monjes <ing(dot)bovet(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Problemas con el pg_cron
Date: 2024-07-10 20:34:44
Message-ID: CAFsReFX-c4cNk3NSrWY5J6YYoykS65JZU-veGbBWbUwsrBRncw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Wed, 10 Jul 2024 at 16:29, Fernando Monjes <ing(dot)bovet(at)gmail(dot)com> wrote:
>
> Si tambien tengo esa libreria cargada en postgresql.conf
> shared_preload_libraries = pg_cron
>
Busca que tengas creada la extensión:

select name default_version, installed_version from
pg_available_extensions where name = 'pg_cron';

> Atentamente,
>
>
> Fernando Monjes B.
> Consultor DBA
> Ingeniero en Informática
> Cel: 09 -78521024
>
>
> El El mié, 10 jul. 2024 a la(s) 16:23, Mario González Troncoso <gonzalemario(at)gmail(dot)com> escribió:
>>
>> On Wed, 10 Jul 2024 at 15:50, Fernando Monjes <ing(dot)bovet(at)gmail(dot)com> wrote:
>> [...]
>> >
>> > En el Postgresql.conf
>> > Listen_address = *
>> > cron.database_name = 'xxxxdb'
>> > cron.host = ' '
>> > cron.use_background_workers = on
>> > max_worker_processes = 8
>> >
>>
>> Al parecer las tablas están pero no has empezado el servicio. Como
>> pg_cron es una extensión, tienes una linea algo como?
>> shared_preload_libraries = 'pg_cron'
>>
>>
>> > Intentes en mi BD xxxxdb con usuario postgres
>> > SELECT cron.schedule('test8','30 12 * * *', $$ VACUUM $$);
>> > SELECT cron.schedule('test1','30 12 * * *', 'VACUUM');
>> >
>> > ...
>> > ....
>> > Intente ademas con varios nodename ...
>> > UPDATE cron.job SET nodename = '';
>> > UPDATE cron.job SET nodename = '127.0.0.1';
>> > UPDATE cron.job SET nodename = 'localhost';
>> > UPDATE cron.job SET nodename = '<mi ip>';
>> > UPDATE cron.job SET nodename = '\tmp';
>> >
>> > Tambien le asigne grant
>> > Grant all privileges on schema cron to postgres
>> >
>> > Valide que la conexion funciona- sin pssword
>> > psql -h localhost -p 5432 -U postgres -d xxxxdb
>> > psql (15.7)
>> > Type "help" for help.
>> > xxxxdb=#
>> >
>> > Valide los de pg_hba también
>> >
>> > postgres(at)pgmaster:~/15/data$ cat pg_hba.conf
>> >
>> > # TYPE DATABASE USER ADDRESS METHOD
>> > local all all trust
>> > local xxxxdb postgres trust
>> >
>> > Y tambien configure el .pgpass
>> >
>> > postgres(at)pgmaster:~$ cat .pgpass
>> > <mi ip>:5432:xxxxdb:postgres:xxxxxx
>> > 127.0.0.1:5432:xxxxdb:postgres:xxxxxx
>> > localhost:5432:xxxxdb:postgres:xxxxxx
>> > <hostname>:5432:xxxxdb:postgres:xxxxxx
>> >
>> >
>> > Resultado el mismo, nada !!
>> >
>> > xxxxdb=# select * from cron.job;
>> > jobid | schedule | command | nodename | nodeport | database | username | active | jobname
>> > -------+-------------+--------------------------------------------+-----------+----------+----------+----------+--------+---------
>> > 1 | 52 11 * * * | SELECT crear_code_create() | | 5432 | xxxxdb | postgres | t | test
>> > 8 | 54 11 * * * | SELECT crear_code_create() | | 5432 | xxxxdb | postgres | t | test1
>> > 9 | 58 11 * * * | SELECT esquema.crear_code_create()| | 5432 | xxxxdb | postgres | t | test2
>> > 10 | 59 11 * * * | CALL esquema.crear_code_create()| | 5432 | xxxxdb | postgres | t | test2
>> > ...
>> > ....
>> > 12 | 19 12 * * * | VACUUM | localhost | 5432 | xxxxdb | postgres | t | test5
>> > 13 | 23 12 * * * | VACUUM | localhost | 5432 | xxxxdb | postgres | t | test6
>> > 14 | 26 12 * * * | VACUUM | localhost | 5432 | xxxxdb | postgres | t | test7
>> > 15 | 30 12 * * * | VACUUM | localhost | 5432 | xxxxdb | postgres | t | test8
>> > (9 rows)
>> >
>> > xxxxdb=# select * from cron.job_run_details order by start_time desc limit 5;
>> > jobid | runid | job_pid | database | username | command | status | return_message | start_time | end_time
>> > -------+-------+---------+----------+----------+---------+--------+----------------+------------+----------
>> > (0 rows)
>> > Siempre lo mismo 0 resultado, no se ejecuta
>> >
>> >
>> > Active el log a debug del server postgres pero lo unico que me muestra es:
>> >
>> > log:
>> > 2024-07-10 10:27:11.195 EDT [1829] LOG: pg_cron scheduler started
>> > pero nada de conexiones fallida u otra cosa.
>> >
>> >
>> > Si alguien sabe que me falta se lo agradeceria porque ya se me acabaron los conejos del sombrero
>> >
>> > Gracias
>> >
>> > Fernando Monjes B.
>> > Consultor DBA
>> > Ingeniero en Informática
>> >
>>
>>
>> --
>> https://www.linkedin.com/in/gonzalemario

--
https://www.linkedin.com/in/gonzalemario

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Anthony Sotolongo 2024-07-10 20:37:42 Re: Problemas con el pg_cron
Previous Message Fernando Monjes 2024-07-10 20:28:49 Re: Problemas con el pg_cron