Problemas con el pg_cron

From: Fernando Monjes <ing(dot)bovet(at)gmail(dot)com>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Problemas con el pg_cron
Date: 2024-07-10 17:48:22
Message-ID: CALc2wF7ChvQuh+AAh3s5g5eo37hK4dKXjJ31NC0gcW_ceTsocQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola Comunidad.,

He estado hace rato intentando que funcione el pg_cron, y nada, he
investigado ene pero sin resultado ., los datos y las pruebas en mi
ambiente de laboratorio, :

Postgres: V 15.7
Pg_cron V 1.6
Rocky Linux 8.20
Usuario para pruebas: postgres

En el Postgresql.conf
Listen_address = *
cron.database_name = 'xxxxdb'
cron.host = ' '
cron.use_background_workers = on
max_worker_processes = 8

Intente 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

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Romero, Fernando 2024-07-10 18:03:52 RE: PSQL Dockerizado Productivo?
Previous Message Federico Pascual 2024-07-10 17:18:43 PSQL Dockerizado Productivo?