Re: Problemas con el pg_cron

From: Anthony Sotolongo <asotolongo(at)gmail(dot)com>
To: Fernando Monjes <ing(dot)bovet(at)gmail(dot)com>, pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Problemas con el pg_cron
Date: 2024-07-10 20:37:42
Message-ID: 3e0a59e8-3bd9-47fa-8453-9110d4440d7b@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola Fernando, te comento algunas cositas:

* No veo la configuracion de shared_preload_libraries = 'pg_cron'

* Si puedes evita modificar las tablas del catalogo de pg_cron como cron.job

* A la variable de configuracion cron.host dale el valor de `show
unix_socket_directories;` no en todos las instalaciones es la misma

y no olvides hacer un restart después de esos cambios.

solo para descartar elimina todos tus jobs y crealos después de las
nuevas configuraciones

Saludos

On 10-07-24 13:48, Fernando Monjes wrote:
> 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
>

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Fernando Monjes 2024-07-10 21:44:29 Re: Problemas con el pg_cron
Previous Message Mario González Troncoso 2024-07-10 20:34:44 Re: Problemas con el pg_cron