我在启动过程中收到的错误是:
waiting for server to start....2024-03-13 03:20:52.400 UTC [57] FATAL: could not access file "cron": No such file or directory
Cron可执行文件位于以下路径:
# which cron
/usr/sbin/cron
我执行了以下步骤来设置pg_cron:
Dockerfile有以下几行:
FROM docker.io/library/postgres
RUN apt-get update && \
apt-get install -y \
cron \
postgresql-`postgres -V | awk '{print $3}' | awk -F. '{print $1}'`-cron
其中最后一行变成postgresql-16-cron
启动脚本/docker-Entrypoint-initdb.d/0001-pg_cron.sh包含以下行:
#!/bin/sh
# We need to append a line to the end of postgresql.conf to load the cron shared library
echo -e "shared_preload_libraries='cron'\ncron.database_name = 'mydb'" >> ${PGDATA}/postgresql.conf
# Dump the postgres.conf file for debugging
cat ${PGDATA}/postgresql.conf
# Execute pg_ctl restart so that postgres reloads the updated config file
pg_ctl restart
postgresql. conf的转储显示它的结尾确实有上面的行:
#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
# Add settings for extensions here
shared_preload_libraries='cron'
cron.database_name = 'mydb'
有没有人在最新的Postgres 16这个扩展上取得了成功?